Having a memcache motivated API use is quite easy. Locache doesn't have dependencies and is tiny.
Locache gracefully degrades if the browser does not support localStorage. Normally that is IE6 or IE7, you will not get any mistakes, but caching efforts will be quietly dropped and lookups would always seem to be a cache miss.
Placing, removing and getting worth
If you store an item, that is what you will receive back. By Way of Example, a variety:
Storing complex objects is not a issue too. Just be certain that they're JSON serializable.
You could even perform batch operations.
Placing values which perish
Since localStorage does not support dying worth, but they will nevertheless be left . This might or might not be troublesome for you. If you would like to be certain that they're cleaned up, use the next procedure on page loading, or using a setTimeout loop.