|
602
|
1 |
YUI.add('cache-plugin', function (Y, NAME) { |
|
|
2 |
|
|
|
3 |
/** |
|
|
4 |
* Provides support to use Cache as a Plugin to a Base-based class. |
|
|
5 |
* |
|
|
6 |
* @module cache |
|
|
7 |
* @submodule cache-plugin |
|
|
8 |
*/ |
|
|
9 |
|
|
|
10 |
/** |
|
|
11 |
* Plugin.Cache adds pluginizability to Cache. |
|
|
12 |
* @class Plugin.Cache |
|
|
13 |
* @extends Cache |
|
|
14 |
* @uses Plugin.Base |
|
|
15 |
*/ |
|
|
16 |
function CachePlugin(config) { |
|
|
17 |
var cache = config && config.cache ? config.cache : Y.Cache, |
|
|
18 |
tmpclass = Y.Base.create("dataSourceCache", cache, [Y.Plugin.Base]), |
|
|
19 |
tmpinstance = new tmpclass(config); |
|
|
20 |
tmpclass.NS = "tmpClass"; |
|
|
21 |
return tmpinstance; |
|
|
22 |
} |
|
|
23 |
|
|
|
24 |
Y.mix(CachePlugin, { |
|
|
25 |
/** |
|
|
26 |
* The namespace for the plugin. This will be the property on the host which |
|
|
27 |
* references the plugin instance. |
|
|
28 |
* |
|
|
29 |
* @property NS |
|
|
30 |
* @type String |
|
|
31 |
* @static |
|
|
32 |
* @final |
|
|
33 |
* @value "cache" |
|
|
34 |
*/ |
|
|
35 |
NS: "cache", |
|
|
36 |
|
|
|
37 |
/** |
|
|
38 |
* Class name. |
|
|
39 |
* |
|
|
40 |
* @property NAME |
|
|
41 |
* @type String |
|
|
42 |
* @static |
|
|
43 |
* @final |
|
|
44 |
* @value "dataSourceCache" |
|
|
45 |
*/ |
|
|
46 |
NAME: "cachePlugin" |
|
|
47 |
}); |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
Y.namespace("Plugin").Cache = CachePlugin; |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
}, '@VERSION@', {"requires": ["plugin", "cache-base"]}); |