isExpired

Indicates whether the item expired

isExpired(key)

Parameters

key
{string} name of the key you want to check

Return

This method return a boolean

Exemples

// No expiration

OhMyCache.Local.set('key', 'value')
OhMyCache.Local.isExpired('key') // false


// No expired

OhMyCache.Local.set('key', 'value', {expire: 999999})
OhMyCache.Local.isExpired('key') // false


// Expired

OhMyCache.Local.set('key', 'value', {expire: 1})
// sleep 1 second or more

OhMyCache.Local.isExpired('key') // true