ParoX
ParoX

Reputation: 5941

Modify APC Cache Timeout

Is it possible to modify the ttl (timeout) of an APC entry?

For example if I do

apc_store($cache_key, $productInfo, 100);

but within 100 seconds, I want to increase to 200. I want it to be 200 seconds from the original creation date, while maintaining a hit count.

My assumption is that this is possible because there is a last_modified time in the APC cache viewer, but I only know of apc_store.

I don't want to overwrite the entry with another apc_store as this will reset the hit count and creation date. So at time 0 if I did TTL of 100, at time 33 I would have to now make the TTL be a 167 if I wanted it to expire at time 200 (which is what going from 100 to 200 would do), this requires looking up a creation date and overwriting the data (not needed).

Looking for a solution that avoids those issues.

Upvotes: 0

Views: 1096

Answers (1)

fire
fire

Reputation: 21531

This is not possible unless you store the TTL as part of the data in the key and write your own logic, you will still have to overwrite the entry each time though.

Consider using Memcached instead and you can use touch to achieve this.

Upvotes: 1

Related Questions