x-browser LocalStorage API with a memcached interface
It looks like this
var cache = kizzy'users'var agent = cacheget'Agent'if agentalert'Welcome back ' + agentnameelsecacheset'Agent'name: 'Agent Diaz'
Furthermore, a call to 'set' will return the value, making it quite easy for assignment.
var cache = kizzy'users'var agent = cacheget'Agent' || cacheset'Agent'name: 'Agent Diaz'
Lastly, you can pass an optional third argument to 'set' that tells the cache how long to live
var cache = kizzy'users'var agent = cacheget'Agent' || cacheset'Agent'name: 'Agent Diaz'5000 // time to live set for 5 seconds// wait 3 seconds...setTimeoutalert'Still there ' + cacheget'Agent'name3000// 6 seconds later...setTimeoutcacheget'Agent'name // => expired6000
- Internet Explorer 6+
- Firefox 2+ (when localStorage is enabled (the browser default))
- Safari 4+
$ submodule update --init& make
Tests will not currently pass if run on a file:/// protocol. Otherwise...
$ open tests/test.html
Install Kizzy as an Ender module
$ ender add kizzy
Use it as such:
The name comes from Kunta Kinte, a Mandinka African warrior from the 1700's. After being brought into slavery, he had a daughter whom he named Kizzy, which translates to stay put in hopes that the family would stay together, but not stay a slave.