Selleo / pattern

A collection of lightweight, standardized, rails-oriented patterns.
MIT License
704 stars 40 forks source link

Rails cache fetch is called even when cache expiry period is blank #17

Closed martyciz closed 4 years ago

martyciz commented 5 years ago

Expected behaviour: Not setting cache_expiry_period to anything should prevent any calls to cache store.

Actual behaviour: When using Redis :redis_cache_store, it still makes SET requests to cache store and stores value for each calculation call.

Fix: Prevent calling Rails.cache.fetch when cache_expiry_period is blank to avoid this. Note that doing so makes setting force: option useless, so it can be removed.

Pull request: #14

bartoszmaka commented 4 years ago

I've added a test scenario for the issue https://github.com/Selleo/pattern/pull/25 It will be merged soon

bartoszmaka commented 4 years ago

Done