codeigniter web page cache based on user

Solutions on MaxInterview for codeigniter web page cache based on user by the best coders in the world

showing results for - "codeigniter web page cache based on user"
Laura
26 May 2016
1if (! function_exists('getCacheSettings')){
2	function getCacheSettings($key)
3	{
4		if ($cacheSettingValue = checkCachedValue($key)) {
5			return $cacheSettingValue;
6		}
7
8		$ci = & get_instance();
9		$result = $ci->db->get_where('settings', array('key' => $key));
10
11		if ($result->num_rows() > 0) {
12			$fetchData = $result->row();
13			cacheFetchedData($key, base64_decode($fetchData->value));
14			return base64_decode($fetchData->value);
15		}
16		return null;
17	}
18}
19
20if (! function_exists('checkCachedValue')){
21	function checkCachedValue($key)
22	{
23		$ci = & get_instance();
24		$ci->load->driver('cache', array('adapter' => 'file'));
25		$cacheKeyData = $ci->cache->get("icd10_".$key);
26
27		return !empty($cacheKeyData) ? $cacheKeyData : false;
28	}
29}
30
31if (! function_exists('cacheFetchedData')){
32	function cacheFetchedData($key, $fetchedData)
33	{
34		$ci = & get_instance();
35		$ci->load->driver('cache', array('adapter' => 'file'));
36		// Save into the cache for 12 Hours
37		$ci->cache->save('icd10_'.$key, $fetchedData, 60 * 60 * 12);
38		return $fetchedData;
39	}
40}
41
42
43getCacheSettings('KEY_NAME');
44
45$this->cache->delete('cache_item_id');
46
47This method will ‘clean’ the entire cache. If the deletion of the cache files
48fails, the method will return FALSE.
49
50$this->cache->clean();
51
52refrence:
53https://www.codeigniter.com/userguide3/libraries/caching.html#example-usage
Enrico
10 Feb 2018
1class MY_Output extends CI_Output
2
queries leading to this page
codeigniter 3 web page cachebest practices cache database on codeignitercodeigniter cache queryquery cache for certain time in codeignitercodeigniter cache specific queriescodeigniter cache dynamic pagehow can we clear a cache automatically from browser using codeignitercodeigniter clear browser cachex c3 b3a cache trong codeigniterhow to clear cache in codeigniter 4cache view for 10 minures codeigniter cachehow to enable cache in codeignitercodeigniter cache delete allcodeigniter clear cache every 5 minutescache in codeigniter examplecodeigniter 4 database cachehow to accept cache in codeigniterhow to remove cache in codeigniterhow cache works in codeignitercache in codeignitercache pages codeignitercodeigniter clear cache 3fhow can we clear browser cache from codeignitercodeigniter load cache view with datacodeigniter cache clearcodeigniter cache multi directorycodeigniter query cache examplecache codeignitercache data in codeignitercodeigniter web page cache based on usercache single query in codeignitercache codeigniter 3codeigniter cache exampleckear cache in codeigniter 4codeigniter 3 database cachecodeigniter cache clear commandclear cache in codeigniterhow to disable cache in codeignitercodeigniter 4 cachecodeigniter output cachecache query codeigniterquery cache in codeignitercache system in codeignitercodeigniter cacheclear codeigniter cachecodeigniter view cachecodeigniter 3 caches query resultscodeigniter this 3eview cachesquery cache codeigniterhow to clear the cache of codeigniter 4database cache codeigniter how it worksoutput cache codeignitercodeigniter clear cachecodeigniter config cachefix cache issues codeigniterhow to use cache in codeigniter 4 clear codeigniter cachesave file in cache codeignitercodeiginter save cachecodeigniter driver cache cliremove cache in codeignitercache codeigniter 4how to cache in codeignitercache off 28 29 codeignitercache query codeigniter 4set cache in codeigniterclear cache codeignitercodeigniter db cachecodeigniter cache implementationbrowser cache issue in codeigniterhow to clear codeigniter cacheclear cache codeigniter 4set cache data codeigniter 24this output cache 28 29 codeignitercodeigniter 3 use cachehow to cache a codeigniter websitecodeigniter check if data is from cachehow to works cache at codeigniter 4codeigniter enable cacheenable cache codeigniter 4how cache in codeigniterhow to use cache in codeignitercodeigniter 4 cache queryclear codeigniter cache from controllercacheing in codeignitercache reset in codeigniterhow to clear the cache of codeigniterphp codeiginiter cachingcodeigniter http cachingcodeigniter 3 cache implementwhat is cache in codeignitercodeigniter web page cache based on user