Shopify SDK for Unity
Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | List of all members
Shopify.UIToolkit.LRUCache< T > Class Template Reference

A cache that uses a Least Recently Used (LRU) heurstic for evicting items. More...

Inheritance diagram for Shopify.UIToolkit.LRUCache< T >:
Shopify.UIToolkit.Cache< T >

Public Member Functions

void SetMemorySizeLimit (int newLimit)
 Sets the size limit in bytes that we can store in the cache. More...
 
ResourceForKey (string key)
 Returns the cached resource saved against the given url. More...
 
void SetResourceForKey (string key, T resource)
 Associates the given key with the given resource in the cache. More...
 
void RemoveKey (string key)
 Removes the key and associated resource instance from the cache. More...
 
void Clear ()
 Clears the cache. More...
 

Static Public Attributes

const int DEFAULT_MEMORY_SIZE_LIMIT = 20971520
 The default estimated memory size limit in bytes. More...
 

Protected Member Functions

 LRUCache (int memorySizeLimit)
 

Properties

int MemorySizeLimit [get]
 The estimated size limit in bytes of how much memory we want to use for the cache (readonly). More...
 
int EstimatedMemorySize [get]
 The current estimated size the cache takes up in memory (readonly) More...
 
int Count [get]
 Returns the number of entries in the cache. More...
 
- Properties inherited from Shopify.UIToolkit.Cache< T >
int MemorySizeLimit [get]
 The estimated size limit in bytes of how much memory we want to use for the cache (readonly). More...
 
int EstimatedMemorySize [get]
 The current estimated size the cache takes up in memory (readonly). More...
 
int Count [get]
 Returns the number of entries in the cache (readonly). More...
 

Detailed Description

A cache that uses a Least Recently Used (LRU) heurstic for evicting items.

Type Constraints
T :ICacheable 

Member Function Documentation

◆ Clear()

void Shopify.UIToolkit.LRUCache< T >.Clear ( )
inline

Clears the cache.

Implements Shopify.UIToolkit.Cache< T >.

◆ RemoveKey()

void Shopify.UIToolkit.LRUCache< T >.RemoveKey ( string  key)
inline

Removes the key and associated resource instance from the cache.

Parameters
keyKey to remove from the cache.

Implements Shopify.UIToolkit.Cache< T >.

◆ ResourceForKey()

T Shopify.UIToolkit.LRUCache< T >.ResourceForKey ( string  key)
inline

Returns the cached resource saved against the given url.

Parameters
keyKey mapping to a resource.
Returns
The cached resource associated with the given key.

Implements Shopify.UIToolkit.Cache< T >.

◆ SetMemorySizeLimit()

void Shopify.UIToolkit.LRUCache< T >.SetMemorySizeLimit ( int  newLimit)
inline

Sets the size limit in bytes that we can store in the cache.

Parameters
newLimitNew size limit in bytes.

Implements Shopify.UIToolkit.Cache< T >.

◆ SetResourceForKey()

void Shopify.UIToolkit.LRUCache< T >.SetResourceForKey ( string  key,
resource 
)
inline

Associates the given key with the given resource in the cache.

Parameters
keyKey to cache with.
resourceA resource to cache in memory.

Implements Shopify.UIToolkit.Cache< T >.

Member Data Documentation

◆ DEFAULT_MEMORY_SIZE_LIMIT

const int Shopify.UIToolkit.LRUCache< T >.DEFAULT_MEMORY_SIZE_LIMIT = 20971520
static

The default estimated memory size limit in bytes.

Property Documentation

◆ Count

int Shopify.UIToolkit.LRUCache< T >.Count
get

Returns the number of entries in the cache.

Returns
Number of entries in the cache.

◆ EstimatedMemorySize

int Shopify.UIToolkit.LRUCache< T >.EstimatedMemorySize
get

The current estimated size the cache takes up in memory (readonly)

Returns

◆ MemorySizeLimit

int Shopify.UIToolkit.LRUCache< T >.MemorySizeLimit
get

The estimated size limit in bytes of how much memory we want to use for the cache (readonly).

Returns

The documentation for this class was generated from the following file: