/
sammy.cache-latest.min.js
6 lines (6 loc) · 1.58 KB
/
sammy.cache-latest.min.js
1
2
3
4
5
6
// -- Sammy.js -- /plugins/sammy.cache.js
// http://sammyjs.org
// Version: 0.7.3
// Built: 2013-01-27 13:00:05 -0500
// deprecated
(function(e){typeof define=="function"&&define.amd?define(["jquery","sammy"],e):(window.Sammy=window.Sammy||{}).MemoryCacheProxy=e(window.jQuery,window.Sammy)})(function(e,t){return t.MemoryCacheProxy=function(e){this._cache=e||{}},e.extend(t.MemoryCacheProxy.prototype,{exists:function(e){return typeof this._cache[e]!="undefined"},set:function(e,t){return this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(e){delete this._cache[e]}}),t.DataCacheProxy=function(t,n){t=t||{},this.$element=n,e.each(t,function(e,t){n.data("cache."+e,t)})},e.extend(t.DataCacheProxy.prototype,{exists:function(e){return typeof this.$element.data("cache."+e)!="undefined"},set:function(e,t){return this.$element.data("cache."+e,t)},get:function(e){return this.$element.data("cache."+e)},clear:function(e){this.$element.removeData("cache."+e)}}),t.Cache=function(n,r){n.log("**WARNING:** This version of Sammy.Cache has been deprecated in favor of using the version in Sammy.Storage and will be removed in 1.0"),r=="data"?this.cache_proxy=new t.DataCacheProxy({},this.$element()):this.cache_proxy=new t.MemoryCacheProxy({}),n.cache_partials=!0,e.extend(n,{cache:function(t,n){return typeof n=="undefined"?this.cache_proxy.get(t):e.isFunction(n)&&!this.cache_proxy.exists(t)?this.cache_proxy.set(t,n.apply(this)):this.cache_proxy.set(t,n)},clearCache:function(e){return this.cache_proxy.clear(e)}}),n.helpers({cache:function(e,t){return this.app.cache(e,t)}})},t.MemoryCacheProxy});