Files
marqdo/ext/data/cache.mq.md
T
cflmyandCursor 687c168014 feat(parse): use nested YAML import: maps instead of one-liner binds
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target
entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the
old one-liner form, and migrate lib/ext/examples/tests/docs accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 19:33:58 +08:00

63 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
markup: occlusion
title: ext/data/cache
description: Cache Resource (ADR 0007).
import:
plugin: lib/plugin.mq.md
sys: lib/sys.mq.md
table: lib/table.mq.md
---
## _load
**p = > plugin.native_path name="web"**
1. `p`
> plugin.load path=`p`
2. *
> print text=ext/data: native web plugin not found
> sys.exit code=1
****
# cache
+ `url`="memory:"
Key–value cache. Use `memory:` for in-process (tests / single process) or `redis://host:6379/0` for Redis.
> _load
*> web_cache_new url=`url`*
## get
+ `key`
**url = [url](access(self, "url"))**
*> web_cache_get url=`url` key=`key`*
## set
+ `key`
+ `value`
+ `ttl`=None
Optional `ttl` is seconds until expiry.
**url = [url](access(self, "url"))**
*> web_cache_set url=`url` key=`key` value=`value` ttl=`ttl`*
## del
+ `key`
**url = [url](access(self, "url"))**
*> web_cache_del url=`url` key=`key`*
## exists
+ `key`
**url = [url](access(self, "url"))**
*> web_cache_exists url=`url` key=`key`*
## ttl
+ `key`
**url = [url](access(self, "url"))**
*> web_cache_ttl url=`url` key=`key`*