Basically load the information of user_x into memory with memcache, how lengthy will this data stay available?
If your user only logs in annually this information is unnecessary within the memory.
Or shall we be held searching only at that the wrong manner?
memcached FAQ covers a number of this.
You are able to set expire occasions as much as thirty days later on. Next memcached translates it as being to start dating ?, and can expire the product after stated date. This can be a simple (but obscure) auto technician.
When memcached hits its memory limit, it'll instantly expire the earliest / least used records first.
memcached utilizes a lazy expiration, meaning it uses no extra cpu expiring products. When a product is asked for (a get request) it inspections the expiration time to ascertain if the product continues to be valid before coming back it towards the client.
Similarly when adding a brand new item towards the cache, when the cache is full, it'll take a look at for expired products to exchange before changing minimal used products within the cache.
Your cached data might be invalidated anytime due to this. As Dustin stated, this may also stay around forever.