-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
The following returns the value of the cached item only if it is present in the expiresHeap:
{
key: 'removeExpired',
value: function removeExpired() {
// ...
while ((expiredItem = this.$$expiresHeap.peek()) && expiredItem.expires <= now) {
expired[expiredItem.key] = expiredItem.value ? expiredItem.value : null;
this.$$expiresHeap.pop();
}
// ...
if (this.$$onExpire) {
Object.keys(expired).forEach(function (key) {
_this6.$$onExpire(key, expired[key]);
});
}
// ...
}
}However, the heap will only contain the value if you're using in-memory storage:
{
key: 'put',
value: function put(key, value) {
// ...
if (this.$$storage) {
// ...
this.$$expiresHeap.push({
key: key,
expires: item.expires
});
} else {
// ...
this.$$expiresHeap.push(item);
// ...
}
// ...
}
}Ideally, it should work regardless of what storage option you use e.g. local storage.
demisx and Wilt
Metadata
Metadata
Assignees
Labels
No labels