Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: The expiration iImplementing of the Cache adapter is inconsistent. #15485

Closed
aa65535 opened this issue May 12, 2021 · 3 comments · Fixed by #15751
Closed

[BUG]: The expiration iImplementing of the Cache adapter is inconsistent. #15485

aa65535 opened this issue May 12, 2021 · 3 comments · Fixed by #15751
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@aa65535
Copy link

aa65535 commented May 12, 2021

Description of expiration in PSR-16:

Expiration - The actual time when an item is set to go stale. This is calculated by adding the TTL to the time when an object is stored.

An item with a 300 second TTL stored at 1:30:00 will have an expiration of 1:35:00.

Implementing Libraries MAY expire an item before its requested Expiration Time, but MUST treat an item as expired once its Expiration Time is reached. If a calling library asks for an item to be saved but does not specify an expiration time, or specifies a null expiration time or TTL, an Implementing Library MAY use a configured default duration. If no default duration has been set, the Implementing Library MUST interpret that as a request to cache the item forever, or for as long as the underlying implementation supports.

If a negative or zero TTL is provided, the item MUST be deleted from the cache if it exists, as it is expired already.

The current status of each adapter:

Adapter Apcu Libmemcached Memory Redis Stream
ttl = null default TTL default TTL not work default TTL default TTL
ttl = 0 persistent persistent not work report an error expired

The default TTL should be set by each adapter to ensure that the adapter can cache the item forever.

Adapter Apcu Libmemcached Memory Redis Stream
default TTL 0 0 not work null large number or null

If the default TTL of Stream is set to null, the isExpired(array! payload) method should return false.

@niden
Copy link
Sponsor Member

niden commented Nov 1, 2021

@aa65535 Can you look at this please and let me know if it is explained correctly?

phalcon/phalcon#208

@niden niden mentioned this issue Nov 1, 2021
5 tasks
@niden niden added 5.0 The issues we want to solve in the 5.0 release status: medium Medium and removed status: unverified Unverified labels Nov 1, 2021
@niden niden added this to Working on it in Phalcon Roadmap Nov 1, 2021
@niden niden linked a pull request Nov 1, 2021 that will close this issue
5 tasks
@aa65535
Copy link
Author

aa65535 commented Nov 2, 2021

@niden It looks good.

@niden
Copy link
Sponsor Member

niden commented Nov 3, 2021

Resolved in #15751

Thanks @aa65535

@niden niden closed this as completed Nov 3, 2021
Phalcon Roadmap automation moved this from Working on it to Implemented Nov 3, 2021
@niden niden moved this from Implemented to Released in Phalcon Roadmap Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Archived in project
Phalcon Roadmap
  
Released
Development

Successfully merging a pull request may close this issue.

2 participants