Im using memcache to store a json, and it’s working. But the problem is that the cache size grow if I call that line above many times:
memcache.Client.add(memcache.Client(),"searchindex",json)
So I looked at the memcache viewer and the content still the same, since Im using a key that’s already on cache. But, even though the size of cache continues to increase.
First off, that’s a really odd way to invoke an instance method. Normally you would do this:
Or simply:
Since
addwill not overwrite a key that already exists in cache, calling it repeatedly should have no impact on the behavior of your application.Whether or not these calls increase the cache size shouldn’t really be a concern. Memcache is designed to make memory available as it’s needed by your application, based on a least use algorithm. Junk memory from inert should
addcalls should certainly be evicted first.