https://github.com/gbaldera/ticaching
Commonjs module for caching data in Apps made with Titanium Mobile
https://github.com/gbaldera/ticaching
commonjs javascript titanium-mobile
Last synced: 10 months ago
JSON representation
Commonjs module for caching data in Apps made with Titanium Mobile
- Host: GitHub
- URL: https://github.com/gbaldera/ticaching
- Owner: gbaldera
- Created: 2012-05-23T01:01:47.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2017-11-28T14:33:46.000Z (over 8 years ago)
- Last Synced: 2025-08-13T13:45:16.036Z (10 months ago)
- Topics: commonjs, javascript, titanium-mobile
- Language: JavaScript
- Size: 3.91 KB
- Stars: 23
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TiCaching
================
**Version:** 1.0
**Platforms:** tested on iOS and Android
**TiCaching** is a Commonjs module for caching data objects in apps made with [Appcelerator's Titanium Mobile](http://www.appcelerator.com/platform/titanium-sdk), useful for cache data returned from REST APIs. It is based on my [Caching library](https://github.com/gbaldera/CI-Caching/) for Codeigniter.
Usage
================
Just copy the "ticaching.js" anywhere in your project's Resources directory and references it like this:
```js
var caching = require('ticaching');
```
After that, use the caching functions:
```js
//cached some data
var data = {'name': 'Gustavo', 'age': 24, 'country': 'Dominican Republic'}
caching.save('my_key', data, 60) // cache data for 1 minute
caching.save('my_key', data) // or cache data for 30 seconds (default)
//get cached data
var data = caching.get('my_key');
// delete chached data
caching.del('my_key');
// delete all chached data
caching.clear();
// delete all expired data
caching.clear(true);
// check if especific key exists
caching.exists('my_key');
```