BackboneCache
Backbone cache plugin for models and collections
Install / Use
/learn @naorye/BackboneCacheREADME
Backbone.Cache
Backbone cache plugin for models and collections
Getting Started
This is a Backbone cache plugin. After integrating this plugin with your application you can easily cahce your collections and models data.
This Implementation Relies on the following libraries:
- Backbone (https://github.com/documentcloud/backbone)
- jQuery (http://jquery.com/)
More information can be found here: <a href="http://www.webdeveasy.com/backbone-cache" target="_blank">http://www.webdeveasy.com/backbone-cache</a>
Usage
-
Define your cache object (can be more then one). In this sample we define global application cache.
app.globalCache = new Backbone.Cache(); -
For each model / collection which you want to cache, extend from
Backbone.CachedModel/Backbone.CachedCollectionand set thecacheKeyandcacheObjectproperties.var UserPermissions = Backbone.CachedModel.extend({ cacheObject: app.globalCache, initialize: function() { var userId = this.get('id'); if (userId) { this.cacheKey = "UserPermissions_" + userId; } }, urlRoot: 'api/user/permissions' }); -
Somewhere in the application call fetch.
var user1Permissions = new UserPermissions({ id: 1 }); user1Permissions.fetch(); -
Later in the application call another fetch. This time the cached data returns without server calling.
var permissions = new UserPermissions({ id: 1 }); permissions.fetch();
Copyright (c) 2013 naorye
Related Skills
node-connect
351.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
