Re: PSR6 // Major questions about TTL

2017-08-08 Thread Georges L.
It's weird to see that almost no one seems to be concerned by those 
questions ?

Le vendredi 4 août 2017 00:25:19 UTC+2, Georges L. a écrit :
>
>
>
> Le mercredi 2 août 2017 11:59:01 UTC+2, Jason Judge a écrit :
>>
>>
>>
>> On Tuesday, 1 August 2017 20:01:15 UTC+1, Georges L. wrote:
>>>
>>>
>>>
>>> Le mardi 1 août 2017 05:49:22 UTC+2, Larry Garfield a écrit :

 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).


 Ok ! 
>>>
>>>  
>>>
 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.

 If I understand well, passing an expired time is the same thing than 
>>> deleting the CacheItem (by forcing it to expire) ?
>>>  
>>>
 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?

>>>
>>> As you can see here:
>>>
>>> https://github.com/PHPSocialNetwork/phpfastcache/blob/final/src/phpFastCache/CacheManager.php#L183
>>>
>>> I store the cache items objects to re-serve them statically later if 
>>> needed (until the script end or detachAllItems() is called).
>>>
>>
>> Are you asking if the interface can be used as just a single-request 
>> cache, with items only lasting as long as the current page request? It 
>> would certainly be nice at times to be able to switch a cache library to 
>> this mode for development.
>>
>
> Not at all, this is the current behavior of the lib. I do have already a 
> static 
> cache 
> 
>  
> for development purpose. 
> Unless you call detachAllItems() (which purge the internal reference 
> pointers to the cache items), the getItem() method will serves you a 
> memore-cached item.
> I did a quick paint draw to help you to get the concept:
>  
>
>
> 
>

-- 
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/0b9de271-3ff3-4393-9729-8c8068f45205%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PSR6 // Major questions about TTL

2017-08-03 Thread Georges L.


Le mercredi 2 août 2017 11:59:01 UTC+2, Jason Judge a écrit :
>
>
>
> On Tuesday, 1 August 2017 20:01:15 UTC+1, Georges L. wrote:
>>
>>
>>
>> Le mardi 1 août 2017 05:49:22 UTC+2, Larry Garfield a écrit :
>>>
>>> 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).
>>>
>>>
>>> Ok ! 
>>
>>  
>>
>>> 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.
>>>
>>> If I understand well, passing an expired time is the same thing than 
>> deleting the CacheItem (by forcing it to expire) ?
>>  
>>
>>> 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?
>>>
>>
>> As you can see here:
>>
>> https://github.com/PHPSocialNetwork/phpfastcache/blob/final/src/phpFastCache/CacheManager.php#L183
>>
>> I store the cache items objects to re-serve them statically later if 
>> needed (until the script end or detachAllItems() is called).
>>
>
> Are you asking if the interface can be used as just a single-request 
> cache, with items only lasting as long as the current page request? It 
> would certainly be nice at times to be able to switch a cache library to 
> this mode for development.
>

Not at all, this is the current behavior of the lib. I do have already a static 
cache 

 
for development purpose. 
Unless you call detachAllItems() (which purge the internal reference 
pointers to the cache items), the getItem() method will serves you a 
memore-cached item.
I did a quick paint draw to help you to get the concept:
 



-- 
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/f1df8a8f-bf6c-4229-ab5e-ef8af4b77174%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PSR6 // Major questions about TTL

2017-08-02 Thread Jason Judge


On Tuesday, 1 August 2017 20:01:15 UTC+1, Georges L. wrote:
>
>
>
> Le mardi 1 août 2017 05:49:22 UTC+2, Larry Garfield a écrit :
>>
>> 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).
>>
>>
>> Ok ! 
>
>  
>
>> 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.
>>
>> If I understand well, passing an expired time is the same thing than 
> deleting the CacheItem (by forcing it to expire) ?
>  
>
>> 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?
>>
>
> As you can see here:
>
> https://github.com/PHPSocialNetwork/phpfastcache/blob/final/src/phpFastCache/CacheManager.php#L183
>
> I store the cache items objects to re-serve them statically later if 
> needed (until the script end or detachAllItems() is called).
>

Are you asking if the interface can be used as just a single-request cache, 
with items only lasting as long as the current page request? It would 
certainly be nice at times to be able to switch a cache library to this 
mode for development.

-- 
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/e974adfc-7af4-4c85-8a3a-60474d5c6f1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PSR6 // Major questions about TTL

2017-08-01 Thread Georges L.


Le mardi 1 août 2017 05:49:22 UTC+2, Larry Garfield a écrit :
>
> 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).
>
>
> Ok ! 

 

> 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.
>
> If I understand well, passing an expired time is the same thing than 
deleting the CacheItem (by forcing it to expire) ?
 

> 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?
>

As you can see here:
https://github.com/PHPSocialNetwork/phpfastcache/blob/final/src/phpFastCache/CacheManager.php#L183

I store the cache items objects to re-serve them statically later if needed 
(until the script end or detachAllItems() is called).

 

>
> --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/91d49241-5ad1-4c3a-89ba-d403aff31c41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PSR6 // Major questions about TTL

2017-07-31 Thread Larry Garfield
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.


PSR6 // Major questions about TTL

2017-07-30 Thread Georges L.
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).

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)

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.

Cheers,
Georges.L


-- 
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/3abe0736-1b7e-4aff-b224-c778e2456aaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.