Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F210088
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/includes/cache/cache.php b/includes/cache/cache.php
--- a/includes/cache/cache.php
+++ b/includes/cache/cache.php
@@ -1,46 +1,48 @@
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* Cache calling class.
*
* 0.1 2010-07-06 22:45 Initial version [DcK]
*
*/
class Cache {
/*
* Gets the cache instance, initializing it if needed
* @eturn Cache the cache instance, or null if nothing is cached
*/
static function load () {
global $Config;
if (
!array_key_exists('cache', $Config) ||
!array_key_exists('engine', $Config['cache'])
) {
//cache is not configured or engine is not specified
- return null;
+ $engine = 'void';
+ } else {
+ //engine is specified in the configuration
+ $engine = $Config['cache']['engine'];
}
-
- $engine = $Config['cache']['engine'];
+
$engine_file = 'includes/cache/' . $engine . '.php';
$engine_class = 'Cache' . ucfirst($engine);
if (!file_exists($engine_file)) {
message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_file not found.", 'Cache');
}
require_once($engine_file);
if (!class_exists($engine_class)) {
message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_class class not found.", 'Cache');
}
return call_user_func(array($engine_class, 'load'));
}
}
?>
\ No newline at end of file
diff --git a/includes/cache/void.php b/includes/cache/void.php
new file mode 100644
--- /dev/null
+++ b/includes/cache/void.php
@@ -0,0 +1,54 @@
+<?php
+/*
+ * Zed
+ * (c) 2010, Dereckson, some rights reserved
+ * Released under BSD license
+ *
+ * Cache class: void
+ *
+ * 0.1 2010-07-06 22:55 Initial version [DcK]
+ *
+ * This class doesn't cache information, it'a void wrapper
+ * get will always return null
+ * set and delete do nothing
+ *
+ * This class implements a singleton pattern.
+ *
+ */
+
+class CacheVoid {
+ /*
+ * @var CacheVoid the current cache instance
+ */
+ static $instance = null;
+
+ /*
+ * Gets the cache instance, initializing it if needed
+ * @eturn Cache the cache instance, or null if nothing is cached
+ */
+ static function load () {
+ if (self::$instance === null) {
+ self::$instance = new CacheVoid();
+ }
+
+ return self::$instance;
+ }
+
+ /*
+ * Gets the specified key's data
+ */
+ function get ($key) {
+ return null;
+ }
+
+ /*
+ * Sets the specified data at the specified key
+ */
+ function set ($key, $value) { }
+
+ /*
+ * Deletes the specified key's data
+ */
+ function delete ($key) { }
+}
+?>
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Nov 10, 20:06 (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20888
Default Alt Text
(2 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment