Skip to content

Return CacheResult from Client#get_cas#78

Open
drinkbeer wants to merge 1 commit into
mainfrom
drinkbeer/get-cas-cache-result
Open

Return CacheResult from Client#get_cas#78
drinkbeer wants to merge 1 commit into
mainfrom
drinkbeer/get-cas-cache-result

Conversation

@drinkbeer

Copy link
Copy Markdown

Summary

  • extend Dalli::CacheResult with an optional cas_token
  • return a frozen CacheResult from no-block Client#get_cas, including hit, miss, and stale state
  • preserve the existing block yield contract and the behavior of cas, cas!, set_cas, and get_multi_cas

This intentionally changes no-block get_cas from [value, cas_token] to a result object. Callers should use result.value and result.cas_token; a true miss has token 0, while non-CAS status reads leave the token nil.

Related (Shopify internal): https://github.com/shop/issues-caching-platform/issues/303

Validation

  • bundle exec rake (458 runs, 50,356 assertions)
  • bundle exec rubocop --parallel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant