aacanakin
aacanakin

Reputation: 2913

strange memcache behaviour on local apache server

I'm currently having troubles about local deployment of my web service api. I'm using memcached with PHP Memcache extension. Here's the following behaviour;

I have a login function that firstly checks whether the user information is on memory with following code;

$cache = Memcacher::get_instance()->load( 'user.' . $email);

the parameter $login is an associative array that holds user info.

After saving it to the memory, I try to re-login. However, it doesn't hold the info before I save to memcached server 3-4 times.

After 3-4 login, I get the login information from cache successfully.

Can anyone explain me that strange behaviour ? Is there any memcached configuration variable to prevent this ?

NOTE : I'm flushing the memory with restarting memcached with sudo service memcached restart on Ubuntu

NOTE : Memcacher is a custom module that uses PHP Memcache extension's set() and get() function

NOTE : Here's the source code of Memcacher

Upvotes: 2

Views: 141

Answers (1)

Xnoise
Xnoise

Reputation: 522

You are concatenating an array with a string. At points, it might not be true that $login is an array, therefore you will start receiving the information you have because the concatenation will work. But if it is an array, you will not be able to save the key in memcache. You will receive a notice, which i guess you ignore.

Upvotes: 1

Related Questions