diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui3.0.0/examples/cache/cache_basic.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui3.0.0/examples/cache/cache_basic.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,229 @@ + + + + + YUI Library Examples: Cache Utility: Basic Caching + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Cache Utility: Basic Caching

+
+
+ + +
+
+
+
+ +

Cache Utility: Basic Caching

+ +
+
+ The Cache Utility provides a basic caching mechanism for storing key/value pairs in local JavaScript memory. +
+ +
+
+ + + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ +
+
+ + + + + + + + +
+
+
+ +
  1. YUI().use("cache", function(Y) {
  2. // Configure Cache maximum size in the constructor
  3. var cache = new Y.Cache({max:5});
  4.  
  5. // Add entries to the Cache
  6. cache.add("key1", "value1");
  7. cache.add("key2", "value2");
  8.  
  9. // Retrieve a cached entry
  10. var cachedentry = cache.retrieve("key1");
  11.  
  12. // Cached entry is an object with a request property and a response property
  13. alert("cached key: " + cachedentry.request +
  14. "/cached value: " + cachedentry.response);
  15.  
  16. // Flush the cache
  17. cache.flush();
  18. });
YUI().use("cache", function(Y) {
+    // Configure Cache maximum size in the constructor
+    var cache = new Y.Cache({max:5});
+ 
+    // Add entries to the Cache
+    cache.add("key1", "value1");
+    cache.add("key2", "value2");
+ 
+    // Retrieve a cached entry
+    var cachedentry = cache.retrieve("key1");
+ 
+    // Cached entry is an object with a request property and a response property
+    alert("cached key: " + cachedentry.request +
+        "/cached value: " + cachedentry.response);
+ 
+    // Flush the cache
+    cache.flush();
+});
+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+
+ + + + + +