View code example
Cache is an essential function of every system. We can use Yao's own cache function to store some temporary data.
process | Description | Documentation |
---|---|---|
cache.Set | Set cache content | - |
cache.Get | Get cache content | - |
{"name": "Cache","description": "Cache Description","type": "lru","option": {}}
Field | Description |
---|---|
name | name |
description | description |
type | Type: lru |
Store uses cache, add file stores/cache.lru.json
:
Application directory structure:
├── apis # Used to store interface description files│├── models # Used to store data model description files│├── db└── stores # is used to store the cache directory|└── app.json
cache.lru.json
:{"name": "LRU Cache","description": "LRU cache","type": "lru","option": { "size": 102400 }}
scripts/test.js
function cacheOperation() {var cache = new Store("cache");cache.Set("key", "for bar .....");var cache_info = cache.Get("key");return cache_info;}
run yao run scripts.test.cacheOperation
new Store("cache")
, set cache: cache.Set
, get cache cache.Get("key")
View code example
Cache is an essential function of every system. We can use Yao's own cache function to store some temporary data.
process | Description | Documentation |
---|---|---|
cache.Set | Set cache content | - |
cache.Get | Get cache content | - |
{"name": "Cache","description": "Cache Description","type": "lru","option": {}}
Field | Description |
---|---|
name | name |
description | description |
type | Type: lru |
Store uses cache, add file stores/cache.lru.json
:
Application directory structure:
├── apis # Used to store interface description files│├── models # Used to store data model description files│├── db└── stores # is used to store the cache directory|└── app.json
cache.lru.json
:{"name": "LRU Cache","description": "LRU cache","type": "lru","option": { "size": 102400 }}
scripts/test.js
function cacheOperation() {var cache = new Store("cache");cache.Set("key", "for bar .....");var cache_info = cache.Get("key");return cache_info;}
run yao run scripts.test.cacheOperation
new Store("cache")
, set cache: cache.Set
, get cache cache.Get("key")