RBDataMemoryCache Class Reference

Inherits from NSObject
Declared in RBDataMemoryCache.h

Overview

A managed memory cache for NSData objects.

  maximumCacheSizeInBytes

The maximum size that the cache can be in bytes.

@property (nonatomic, readonly) NSUInteger maximumCacheSizeInBytes

Discussion

The maximum size that the cache can be in bytes.

Declared In

RBDataMemoryCache.h

  cacheSizeInBytes

The current size of the cache.

@property (nonatomic, readonly) NSUInteger cacheSizeInBytes

Discussion

The current size of the cache.

Declared In

RBDataMemoryCache.h

– initWithMaximumCacheSize:

Creates a new cache with the given maximum size.

- (nonnull instancetype)initWithMaximumCacheSize:(NSUInteger)maximumCacheSizeInBytes

Parameters

maximumCacheSizeInBytes

The maximum size that the cache can be in bytes.

Return Value

The new cache object.

Discussion

Creates a new cache with the given maximum size.

Declared In

RBDataMemoryCache.h

– storeDataItem:key:group:expiryInterval:

Store a data item in the cache.

- (void)storeDataItem:(nonnull NSData *)dataItem key:(nonnull NSString *)key group:(nullable NSString *)group expiryInterval:(NSTimeInterval)expiryInterval

Parameters

dataItem

The NSData object.

key

The unique key to store the data with.

group

The group name to store the data in (optional).

expiryInterval

The time span after which the data is expired and removed.

Discussion

Store a data item in the cache.

Declared In

RBDataMemoryCache.h

– dataItemExistsWithKey:

Determines whether or not a data item is stored with the given key.

- (BOOL)dataItemExistsWithKey:(nonnull NSString *)key

Parameters

key

The key for which to check if there is a data item stored.

Return Value

Whether a data item was found with the key.

Discussion

Determines whether or not a data item is stored with the given key.

Declared In

RBDataMemoryCache.h

– fetchDataItemWithKey:

Retrieves the data item stored with the given key.

- (nullable NSData *)fetchDataItemWithKey:(nonnull NSString *)key

Parameters

key

The key with which to retrieve the data item.

Return Value

The retrieved data item.

Discussion

Retrieves the data item stored with the given key.

Declared In

RBDataMemoryCache.h

– removeDataItemWithKey:

Remove the data item stored with the given key.

- (void)removeDataItemWithKey:(nonnull NSString *)key

Parameters

key

The key to remove the stored data item for.

Discussion

Remove the data item stored with the given key.

Declared In

RBDataMemoryCache.h

– removeAllItemsWithGroup:

Remove all of the items stored in the given group.

- (void)removeAllItemsWithGroup:(nonnull NSString *)group

Parameters

group

The group for which to remove all stored data items.

Discussion

Remove all of the items stored in the given group.

Declared In

RBDataMemoryCache.h

– removeAllExpiredItems

Removes all data items that have expired.

- (void)removeAllExpiredItems

Discussion

Removes all data items that have expired.

Declared In

RBDataMemoryCache.h