Add cache expiration support (TTL) by clue · Pull Request #29 · reactphp/cache · GitHub
Skip to content

Add cache expiration support (TTL)#29

Merged
clue merged 2 commits into
reactphp:masterfrom
clue-labs:ttl
Jun 8, 2018
Merged

Add cache expiration support (TTL)#29
clue merged 2 commits into
reactphp:masterfrom
clue-labs:ttl

Conversation

@clue

@clue clue commented Jun 8, 2018

Copy link
Copy Markdown
Member

This PR adds support for cache expiry (TTL). This is a new feature for most consumers, but this is also a BC break because it adds a new parameter to the CacheInterface::set($name, $value, $ttl = null) signature.

As its name implies, the ArrayCache uses an array to store the optional TTL and will yield a cache miss when a cache item is expired.

Builds on top of #28, thank you @WyriHaximus for the initial version! I've squashed the original version to a single commit to preserve authorship. Unlike the initial version, this updated version uses an array for significantly faster operation (heavily inspired by reactphp/event-loop#164).

Supersedes / closes #28
Resolves / closes #11

@clue clue added this to the v0.5.0 milestone Jun 8, 2018
@WyriHaximus WyriHaximus requested review from WyriHaximus and jsor June 8, 2018 11:54
Comment thread README.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stores -> store

Comment thread README.md Outdated
The `set(string $key, mixed $value, ?float $ttl = null): PromiseInterface` method can be used to
stores an item in the cache.

This method will resolve with a true on success or false when an error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a true

@WyriHaximus WyriHaximus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@clue

clue commented Jun 8, 2018

Copy link
Copy Markdown
Member Author

@clue clue merged commit 6136d21 into reactphp:master Jun 8, 2018
@clue clue deleted the ttl branch June 8, 2018 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Support TTL

3 participants