Welcome Guest, Not a member yet? Register   Sign In
Memcache in CI
#11

[eluser]pickupman[/eluser]
I think the blog post you are using isn't showing the complete working code which is why you are having issues. The KEY could be something defined, or you can use a string. You just have to call the same key to retrieve the contents from that cache.

Code:
$this->cache->get('some_cache_key');
$this->cache->get('another_query');
$this->cache->get('count_table');
The string can be anything you want. Just be sure you are getting/saving the same key you need.
#12

[eluser]hema[/eluser]
k, thank you everything is working fine.
#13

[eluser]hema[/eluser]
$this->load->library('Cache');
$this->cache->useMemcache(MEMCACHE_IP, MEMCACHE_PORT);

//from databse
$query = $this->db->get("country");
$Data= $query->result_array();



foreach ($Data as $Key => $Value)
{




$data = $Value;
$this->cache->save($data["CountryId"].'_country',$data,NULL,3600);
$user = $this->cache->get('$data["CountryId"]_country');
print_r($user);
echo "<br>";
}

// $user is giving me an empty result

Iam getting values from DB but, iam getting an empty page when i run the code.
#14

[eluser]hema[/eluser]
resolved, But i dont no if this is correct way to memcache, because it is not effecting my runtime performance. It is taking 45 milli seconds to get 8 rows of data. Can anyone help me in this issue.

Is this the case, I always insert data and retrieve it or is thr otherway to do(am i getting wrong)




Theme © iAndrew 2016 - Forum software by © MyBB