Skip to content

Conversation

@clue
Copy link
Member

@clue clue 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

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

@WyriHaximus WyriHaximus 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
Member Author

clue commented Jun 8, 2018

@jsor Good catch, updated! :shipit:

@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