What Javascript Cache Can You Recommend
i'm searching for a good java script in-memory cache lib to cache client side calculation results. My requirements: works in Internet Explorer, FireFox, Safari, Opera, Chrome, oth
Solution 1:
Give a look to:
- jsCache: a simple LRU cache.
It's very easy to implement a pattern of self-memorizing functions:
functionisPrime( num ) {
if ( isPrime.cache.getItem(num) != null ) // check if the result is alreadyreturn isPrime.cache.getItem(num); // cachedvar prime = num != 1;
for ( var i = 2; i < num; i++ ) { // determine if the number is primeif ( num % i == 0 ) {
prime = false;
break;
}
}
isPrime.cache.setItem(num, prime); // store the result on cachereturn prime;
}
isPrime.cache = newCache();
//...isPrime(5); // true
isPrime.cache.getItem(5); // true, the result has been cached
You are able to specify the expiration time (absolute or relative), the priority of an item, and a callback function that will be executed when the item is removed from the cache...
Solution 2:
Well, it's still beta and i guess since it is very old it wont be developed further, but maybe your can give it a look:
it was developed by Webframeworks LLC. I once uesed it in a project and it did a very good job so i can recommend it.
Post a Comment for "What Javascript Cache Can You Recommend"