Hi all,

Regarding TTL, I don't care much for DateInterval either but I think it
> carried over from PSR-6
>

I'm all for keeping DateInterval asis, because it will help writing PSR-6
bridges.

The 5-6 lines snippet you gave Rasmus is actually a one-liner in Symfony,
where we deal with absolute timestamps at this stage:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/CacheItem.php#L90


About having a "never expires" TTL, it doesn't exist in PSR-6, so that
would create a de facto incompatibility with it.
Also, since a cache has no requirement for actually storing an item
forever, this would mislead users into thinking that such "never expire"
items are safely stored forever in the storage.
Which is actual not desired nor desirable for a cache backend (see memcache
LRU). Thus, I'm -1 personally on this proposal.

In order to help review PSR-16 on actual code, I just wrote this
(unreviewed nor tested yet) implementation of it for Symfony Cache:
https://github.com/symfony/symfony/pull/20636

Here are my comments based on this work (random order):

On CounterInterface:

   - the draft doesn't say what happens when $key is invalid. I guess the
   same exception as PSR-6. Should be written?
   - nor does it say when $step is not an integer (return false? throw
   something?)
   - what should happen when $key already exists in the storage by it not
   "incrementable"? (Redis INCR fails, I didn't check apcu) => return false ?
   throw ? erase and store $step? other ?

On CacheInterface:

   - doesn't say what happens when $key is invalid. I guess the same
   exception as PSR-6. Should be written?

Thanks to everyone involved!

Nicolas

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CAOWwgpmNTDYsGsxJNvSJOj7h8NQAe9YA%3DT0mq850v0W%2BQH255w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to