On 07/30/2017 09:34 AM, Georges L. wrote:
> Hello folks,
>
> today during a new test implementation (I am the Lead behind
> PhpFastCache) I got a major question on a concept of the Psr6:
>
> 1) If you set a cache item with a TTL of 1sec, then your script
> duration take more than 2secondes: What's the expected behavior of
> isHit() ? Supposing that I'm using the _same instance_ of my cacheItem
> during the whole script execution (not by calling getItem() again).

The cache lifetime applies as of the moment that the request is run, and
isHit() is guaranteed.  That is, if at the millisecond that getItem() or
isHit() runs (technically it could be either, I suppose, depending on
the implementation) the cache item is valid, then that CacheItem object
remains valid until it goes out of scope.

> 2)In the same spirit: What's the expected behavior of passing a "past"
> value to expireAt/ExpirerAfter ? This is not mentioned at all in the
> Psr6 specs (Only if null is passed)

Setting an expire time that's in the past is functionally equivalent to
not setting it.  Whether the implementation even bothers to try writing
it is, I suppose, up to it, but since a lookup for it will always return
a cache miss it doesn't much matter.

> 3) Should getItem() stores instances inside a private property, or
> should it MIUST get it from the cache storage directly ? This is not
> mentioned either.

I'm not sure I follow here.  Can you clarify?

--Larry Garfield

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/db3cfaf3-a612-aeee-a272-1f356f686161%40garfieldtech.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to