Fix possible compilation error for variables expecting any kind of cache store#32
Conversation
|
Thanks! |
|
@ellmetha I apologize, but I had to revert your changes because I don't think it's a good idea to make |
|
@ellmetha By adding this code to |
No worries! Avoiding a breaking change seems sensible to me. Regarding Out of curiosity, what was the rationale for enforcing |
|
The concept of The rationale behind enforcing By default, when initializing cache stores, the I'm not opposed to |
I agree that an expiry time will be specified in most situations (like probably 99% of the time). Though I've seen cases where specifying an expiry explicitly didn't really make sense for the task at hand (eg. storing timestamp versions for resources in a Memcached store that were then used as part of cache keys in order to handle some cache invalidation strategies with some API clients, storing a resource in a memory store for the whole duration of the worker process, etc). Giving the option to the users of this shard would be nice IMHO! |
|
@ellmetha |
Description
I encountered a possible compilation error with the
Cache::Storeclass when defining variables accepting any kind ofCache::Store(String, String)object.For example:
This snippet fails with the following compilation error:
It seems that this is related to the use of the
@expires_ininstance variable in theCache::Storeabstract class: this instance variable is not defined by this class directly but is referenced nonetheless.To fix this, I ensured that a nilable
@expires_ininstance variable is defined in theCache::Storeabstract class. This also led me to modify theCache::Entrystruct so that its@expires_atinstance is nilable as well (I imagine this makes sense given that some entries could not have expiry times).