Ticket Details

cache should allow integer as an expiry, and it should allow for infinite ttl if 0 gets explicitly passed

ENHANCEMENT Ticket (in progress)

###What happened:
Currently, the storage API doesn't seem to allow a ttl of 0 (i.e. infinite) for APC, memcached, etc. It also disallows to pass a straightforward integer as a ttl, which would save expensive strtotime calls.


###What was expected:
Passing an integer should be allowed, and passing 0 should allow for an infinite ttl.

on 08.24.10 reported by: ddebernardy owned by: daschl

Updates

on 08.24.10 by ddebernardy
  • type was changed to enhancement
on 03.21.11 by daschl
Hi,

it is currently possible __for some adapters__ that you can specify an integer value as the expiry time. As far as i can see, the APC and the Redis adapter should be "integer aware", the others are not.

APC:
http://dev.lithify.me/lithium/source/libraries/lithium/storage/cache/adapter/Apc.php#73

Redis:
http://dev.lithify.me/lithium/source/libraries/lithium/storage/cache/adapter/Redis.php#130

I think two things need to be done to make this consistent:
- XCache, File and Memcache should also contain the `is_int()` check
- The `write` method docs should be updated accordingly.

Regards,
Mike
on 03.21.11 by nate
  • owner was changed to nate
  • status was changed to in progress
on 03.21.11 by nate
  • owner was changed to daschl