summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Cache/Cache.php10
-rw-r--r--user_guide_src/source/libraries/caching.rst10
2 files changed, 20 insertions, 0 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index b56f33e74..676375c37 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -253,4 +253,14 @@ class CI_Cache extends CI_Driver_Library {
return $support[$driver];
}
+
+ /**
+ * Get currently loaded driver
+ *
+ * @return string
+ */
+ public function get_loaded_driver()
+ {
+ return $this->_adapter;
+ }
}
diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst
index 6621c94ea..2226b4281 100644
--- a/user_guide_src/source/libraries/caching.rst
+++ b/user_guide_src/source/libraries/caching.rst
@@ -188,6 +188,16 @@ Class Reference
.. note:: The information returned and the structure of the data is dependent
on which adapter is being used.
+ .. php:method:: get_loaded_driver()
+
+ :returns: Loaded driver name, based on initialization config ('apc', 'apcu', 'dummy', 'file', 'memcached', 'redis' or 'wincache')
+ :rtype: string
+
+ This method will return the caching driver currently used after initialization.
+ ::
+
+ echo $this->cache->get_loaded_driver(); // Will return something like "file"
+
*******
Drivers
*******