new CacheMapBased(evictPolicyopt, capacityopt, eqCompareropt)
Creates a new, empty CacheMapBased, using the specified @see {EvictionPolicy} and
an initial capacity.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
evictPolicy |
EvictionPolicy | Number |
<optional> |
Optional. Specify the eviction policy that is applied, if the cache has no more space left. |
capacity |
Number |
<optional> |
Optional. Specify the initial capacity of this cache. The capacity can be increased and decreased later. |
eqComparer |
EqualityComparer.<TVal> |
<optional> |
Optional. Defaults To EqualityComparer |
- Source:
Members
capacity :Number
Returns the current capacity of this cache.
Type:
- Number
- Source:
capacity :void
Type:
- void
- Source:
evictionPolicy :EvictionPolicy|Number
Type:
- EvictionPolicy | Number
- Source:
evictionPolicy
- Source:
isFull :Boolean
Returns true, if the cache's capacity is all used up.
Type:
- Boolean
- Source:
observableEvict :Observable.<CollectionEvent.<Array.<TVal>>>
Type:
- Observable.<CollectionEvent.<Array.<TVal>>>
- Source:
Methods
(generator) entries()
- Source:
evict() → {T}
- Source:
Returns:
the evicted item.
- Type
- T
evictMany(count) → {Array.<T>}
Parameters:
Name | Type | Description |
---|---|---|
count |
Number |
- Source:
Returns:
The evicted items in an array.
- Type
- Array.<T>
get()
- Source:
peekEvict(amount)
Allows to peek at the next n items that will be evicted next, without
removing them. Returns the items as key/value pair.
Parameters:
Name | Type | Description |
---|---|---|
amount |
Number |
- Source:
Returns:
set(expireAfterMsecsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
expireAfterMsecs |
Number |
<optional> |
Optional. if given a positive integer, then it will be used as the amount of milliseconds this entry will expire and remove itself from the cache. |
- Source:
Throws:
-
If this cache is full and no automatic eviction policy was set.
- Type
- Error
(generator) values()
- Source: