... in preparation for adding an adapter for another templating engine.
The change in Cache::storage() makes it look for a default storage engine in the configuration before using the hard-coded default of 'memory'.
Added the method File::has() to avoid unnecessary method calls from the parent class.
[IMPORTANT] The File::retrieve() method previously returned true if the cache file had expired. This looks like a flaw to me because it is also possible for true to be the value cached in the file. Therefore, I made it return null instead, just as if the cache file didn't exist. (And returning the result of forget() was pointless because we already know it will be true.) See issue #25 also.
Implemented \ArrayAccess in Storage class so that it can be used like an array, since all of the child classes are key-value stores.
Marked Storage::expiration() as static since it doesn't reference $this
... in preparation for adding an adapter for another templating engine.
Cache::storage()
makes it look for a default storage engine in the configuration before using the hard-coded default of 'memory'.File::has()
to avoid unnecessary method calls from the parent class.File::retrieve()
method previously returnedtrue
if the cache file had expired. This looks like a flaw to me because it is also possible fortrue
to be the value cached in the file. Therefore, I made it returnnull
instead, just as if the cache file didn't exist. (And returning the result offorget()
was pointless because we already know it will betrue
.) See issue #25 also.\ArrayAccess
inStorage
class so that it can be used like an array, since all of the child classes are key-value stores.Storage::expiration()
as static since it doesn't reference$this