Welcome Guest, Not a member yet? Register   Sign In
How to read multiple values from cache at once?
#1

(This post was last modified: 12-29-2014, 12:27 AM by sujit510.)

Hello everyone,

I am using memcached in CI and I have saved user information in cache with keys as user_1, user_2, and so on.

While reading them back from cache, I am using iteration as follows -

for ($i = 1, $i <= 10; $i++) {

$UserData = $this->cache->memcached->get("user_" . $i);

//And then process $UserData

}

But when I checked the performance, I found that it takes time due to reading the cached value in iterations.
I want to know if there is any way where I can get all cached values at once by supplying array of keys.. something like following -

for ($i = 1, $i <= 10; $i++) {
$userIDArray[] = "user_" . $i;
}
$UserData = $this->cache->memcached->get($userIDArray);

Thanks.
Reply


Messages In This Thread
How to read multiple values from cache at once? - by sujit510 - 12-28-2014, 10:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB