cache icon indicating copy to clipboard operation
cache copied to clipboard

Adding `increment` and `decrement` methods?

Open frqnck opened this issue 10 years ago • 2 comments

Do you have thoughts about adding a standard "increment" function for the AbstractCache.php in apix-cache? I know that both Redis and Memcached have this function, and its something I need at the moment -- using ->getAdapter()->... Instead. Jonathan

Adding increment/decrement methods to AbstractCache.php would be useful indeed.

It would be good to have a base/inhertied implementations generic enough so that backends without dedicated functions would still benefit.

PDO, Runtime and Filesystem(s) don’t have dedicated (in|de)crementors — the rest do.

Essentially, a base implementations would be a two steps affair, i.e. retrieve and update/upsert a (numerical) value. The default (in|de)cremental value being 1.

frqnck avatar Jan 22 '16 13:01 frqnck

I've added definitions to the interface. Working on a generic version in AbstractCache.php and will do specific implementations for at least Redis and Memcached.

jspalink avatar Jan 25 '16 22:01 jspalink

@jspalink any progress on this?

frqnck avatar Aug 19 '16 14:08 frqnck