monsur / jscache Goto Github PK
View Code? Open in Web Editor NEWJust a simple JavaScript LRU cache.
Just a simple JavaScript LRU cache.
When I'm using Safari in Private Browsing, I got error: "An attempt was made to add something to storage that exceeded the quota."
Stackoverflow says it is by design of Private Browsing.
http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library monsur/jscache
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "monsur/jscache",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
Right now tests are just in an html file. They may be easier to run if they were part of a framework such as Jasmine.
I'd like to recommend that this be added to cdnjs.com, but to do that it the repo would need some version tags and a package.json file.
Hi monsur, first off, let me introduce my self.
My name is Rolando Santamaria Maso, I am part of the jWebSocket (http://jwebsocket.org) project, as Web and Java developer. jWebSocket is a java framework to create RT applications using the websocket protocol.
One of the requirement is browser cache, so we discovered your library and agree that it is useful even have a nice API.
But the HTML5 specs introduce a new concept: Web Storage (http://dev.w3.org/html5/webstorage/)
In order to provide your library as a generic cache (not only RAM), could be very useful if JSCache support the injection of the Storage instance to use.
I made some modifications to a previous version of JSCache, but of course if you still improving the library is a bit complex from my side.
So the API can be like this:
var cache = new Cache(storage);
Benefits:
Re-use the localStorage and sessionStorage from HTML5, even allow new implementations like CouchDB, etc...
Memory Storage impl:
// ****************************************************************************
// MemoryStorage constructor
// Creates a new storage object
MemoryStorage = function MemoryStorage(){
this.length = 0;
this.keys = Array();
this.items = {};
}
MemoryStorage.prototype.key = function(index){
return (this.keys[index]) ? this.keys[index] : null;
}
MemoryStorage.prototype.getItem = function(key){
return (undefined != this.items[key]) ? this.items[key] : null;
}
MemoryStorage.prototype.setItem = function(key, value){
this.items[key] = value;
this.keys.push(key);
this.length++;
}
MemoryStorage.prototype.removeItem = function(key){
if (undefined == this.items[key]) return;
var newKeys = Array();
for (var i = 0; i < this.keys.length; i++){
if (key != this.keys[i]){
newKeys.push(this.keys[i]);
}
}
this.keys = newKeys;
this.length--;
delete this.items[key];
}
MemoryStorage.prototype.clear = function(){
this.length = 0;
this.items = {};
this.keys = Array();
}
Conclusion:
We are interesting to re-use your library + HTML5 support, of course w/o license violations.
From my part, thanks for this great library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.