https://github.com/fantasyui-com/url-data-cache
Cache data from a url request.
https://github.com/fantasyui-com/url-data-cache
Last synced: over 1 year ago
JSON representation
Cache data from a url request.
- Host: GitHub
- URL: https://github.com/fantasyui-com/url-data-cache
- Owner: fantasyui-com
- License: gpl-3.0
- Created: 2019-07-13T13:13:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T16:16:14.000Z (almost 2 years ago)
- Last Synced: 2025-02-19T10:36:42.984Z (over 1 year ago)
- Language: JavaScript
- Size: 50.8 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# url-cache
Cache data from a url request.
```JavaScript
import urlCacheInstance from 'url-data-cache';
const urlDataCache = urlCacheInstance('my-app');
// or
const urlDataCache = require('url-data-cache')('my-app');
// then
// get from cache (also delete expired)
const cachedData = urlDataCache.get(url);
if(cachedData) return resolve(cachedData);
// put to cache
urlDataCache.put(url, htmlData, '1 hour');
```
Supported time units:
- n second
- n seconds
- n minute
- n minutes
- n hour
- n hours
- n month
- n months
where n is a number