Skip to content

Conversation

@clue
Copy link
Member

@clueclue commented Jun 8, 2018

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

@clueclue added this to the v0.5.0 milestone Jun 8, 2018
README.md Outdated
#### set()

The `set(string $key, mixed $value, ?float $ttl = null): PromiseInterface` method can be used to
stores an item in the cache.
Copy link
Member

Choose a reason for hiding this comment

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

stores -> store

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
Member

Choose a reason for hiding this comment

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

a true

Copy link
Member

@WyriHaximusWyriHaximus left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@clue
Copy link
MemberAuthor

clue commented Jun 8, 2018

@jsor Good catch, updated! :shipit:

jsor
jsor approved these changes Jun 8, 2018
@clueclue merged commit 6136d21 into reactphp:masterJun 8, 2018
@clueclue deleted the ttl branch June 8, 2018 12:52
Sign up for freeto 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

@clue@jsor@WyriHaximus