Daemon Data Methods
Last updated
This page lists the read and write methods on
Daemon, which behave the same whether the process is the server or a client.Data Methods
| Method | Result |
|---|---|
Get(ctx, db, key) | *Record; ErrNotFound when missing or expired |
Entries(ctx, db, pattern, *ScanOption) | []Record filtered on the server |
Set(ctx, db, key, content, expireAt) | Upsert; content is any JSON-marshalable value |
SetVector(ctx, db, key, content, expireAt) | Upsert plus background embedding; ErrNoEmbedder without a key |
Del(ctx, db, keys...) | Number removed; zero keys returns 0 without a request |
TTL(ctx, db, key) | Seconds, -1 when persistent; ErrNotFound when missing |
Expire(ctx, db, ttl, keys...) | Number of keys that received the TTL; zero keys returns 0 |
Keys(ctx, db, pattern, limit, page) | *ListResult |
VSearch(ctx, db, text, pattern, limit) | Keys ordered by similarity |
HasEmbedder(ctx) | Whether the server store has an embedder |
Set stores a JSON string value as its unquoted text and any other JSON value as compacted JSON. null or empty content is rejected with ErrBadRequest. Read a record back with Record.Value() instead of string(record.Content), which would keep the quotes and escapes of string values.