Skip to content

ViacheslavSoroka/VSCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VSCache

A simple thread-safe cache with ability to enumerate all keys and object.

Features

  • Automatic cleanup when too few system memory is left
  • Automatic removing the oldest items when countLimit is excided
  • Thread-safe
  • Enumerating keys and objects

Usage:

Basic usage

VSCache *cache = [VSCache new];
cache.countLimit = 50;

NSString *key = @"someKey";
[cache setObject:[NSObject new] forKey:key];
NSObject *value = [cache objectForKey:key];

Enumeration

VSCache *cache = ...
NSEnumerator *objectEnumerator = [cache objectEnumerator];
for (id object in objectEnumerator) {
    ...
}

NSEnumerator *keyEnumerator = [cache keyEnumerator];
for (id key in keyEnumerator) {
    ...
}

License

VSCache is available under the MIT license. See the LICENSE file for more info.

About

A simple thread-safe cache with ability to enumerate all keys and object.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors