ananthakumaran/memcachex

Support `:default` option on `cas/4`

Closed this issue · 0 comments

This one is a little more "nice-to-have" than my other request, but I'm posting it for your consideration.

Currently cas/4 only works on cache items that already exist. It would be convenient if a :default opttion were supported, to make a "create-or-atomic-update" workflow possible.

If the initial get fails to find the requested key, we could then check opts for a :default key and set that instead.

This functionality is possible to implement with a function that wraps cas/4 in user code, but I thought I'd put the suggestion out there to add built-in support to the library. Thanks.