Skip to content

Instantly share code, notes, and snippets.

@shoyan
Created August 28, 2013 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoyan/6362503 to your computer and use it in GitHub Desktop.
Save shoyan/6362503 to your computer and use it in GitHub Desktop.
シンプルなキャッシュの例
var list = function(val) {
if(!list.cache.hasOwnProperty(val)) {
list.cache[val] = val;
}
return list.cache[val];
}
list.cache = {};
list("foo");
list.cache["foo"] == "foo";
list("var");
list.cache["var"] == "var";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment