Switch private methods and properties to protected and cleanup the Cache library and drivers
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 7642a52..f982416 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Caching Class
*
@@ -50,108 +48,15 @@
protected $_adapter = 'dummy';
protected $_backup_driver;
- public function __construct($config = array())
- {
- if ( ! empty($config))
- {
- $this->_initialize($config);
- }
- }
-
- // ------------------------------------------------------------------------
-
/**
- * Get
- *
- * Look for a value in the cache. If it exists, return the data
- * if not, return FALSE
- *
- * @param string
- * @return mixed value that is stored/FALSE on failure
- */
- public function get($id)
- {
- return $this->{$this->_adapter}->get($id);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Cache Save
- *
- * @param string Unique Key
- * @param mixed Data to store
- * @param int Length of time (in seconds) to cache the data
- *
- * @return boolean true on success/false on failure
- */
- public function save($id, $data, $ttl = 60)
- {
- return $this->{$this->_adapter}->save($id, $data, $ttl);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Delete from Cache
- *
- * @param mixed unique identifier of the item in the cache
- * @return boolean true on success/false on failure
- */
- public function delete($id)
- {
- return $this->{$this->_adapter}->delete($id);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Clean the cache
- *
- * @return boolean false on failure/true on success
- */
- public function clean()
- {
- return $this->{$this->_adapter}->clean();
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Cache Info
- *
- * @param string user/filehits
- * @return mixed array on success, false on failure
- */
- public function cache_info($type = 'user')
- {
- return $this->{$this->_adapter}->cache_info($type);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Get Cache Metadata
- *
- * @param mixed key to get cache metadata on
- * @return mixed return value from child method
- */
- public function get_metadata($id)
- {
- return $this->{$this->_adapter}->get_metadata($id);
- }
-
- // ------------------------------------------------------------------------
-
- /**
- * Initialize
+ * Constructor
*
* Initialize class properties based on the configuration array.
*
* @param array
- * @return void
+ * @return void
*/
- private function _initialize($config)
+ public function __construct($config = array())
{
$default_config = array(
'adapter',
@@ -180,10 +85,92 @@
// ------------------------------------------------------------------------
/**
+ * Get
+ *
+ * Look for a value in the cache. If it exists, return the data
+ * if not, return FALSE
+ *
+ * @param string
+ * @return mixed value that is stored/FALSE on failure
+ */
+ public function get($id)
+ {
+ return $this->{$this->_adapter}->get($id);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Cache Save
+ *
+ * @param string Unique Key
+ * @param mixed Data to store
+ * @param int Length of time (in seconds) to cache the data
+ * @return bool true on success/false on failure
+ */
+ public function save($id, $data, $ttl = 60)
+ {
+ return $this->{$this->_adapter}->save($id, $data, $ttl);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Delete from Cache
+ *
+ * @param mixed unique identifier of the item in the cache
+ * @return bool true on success/false on failure
+ */
+ public function delete($id)
+ {
+ return $this->{$this->_adapter}->delete($id);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Clean the cache
+ *
+ * @return bool false on failure/true on success
+ */
+ public function clean()
+ {
+ return $this->{$this->_adapter}->clean();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Cache Info
+ *
+ * @param string user/filehits
+ * @return mixed array on success, false on failure
+ */
+ public function cache_info($type = 'user')
+ {
+ return $this->{$this->_adapter}->cache_info($type);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get Cache Metadata
+ *
+ * @param mixed key to get cache metadata on
+ * @return mixed return value from child method
+ */
+ public function get_metadata($id)
+ {
+ return $this->{$this->_adapter}->get_metadata($id);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
* Is the requested driver supported in this environment?
*
- * @param string The driver to test.
- * @return array
+ * @param string The driver to test.
+ * @return array
*/
public function is_supported($driver)
{
@@ -202,8 +189,8 @@
/**
* __get()
*
- * @param child
- * @return object
+ * @param child
+ * @return object
*/
public function __get($child)
{
@@ -217,9 +204,7 @@
return $obj;
}
- // ------------------------------------------------------------------------
}
-// End Class
/* End of file Cache.php */
-/* Location: ./system/libraries/Cache/Cache.php */
+/* Location: ./system/libraries/Cache/Cache.php */
\ No newline at end of file