Redis
String yang aman untuk biner, hash, list, set, sorted set, stream, SCAN dan publish dengan prefix key opsional. Tool agent hanya membaca kecuali diizinkan, ada jalur perintah khusus node dengan daftar perintah terlarang
Tentang
Plugin Graphrt untuk Redis (dan server yang kompatibel dengan Redis seperti Valkey), dibangun di atas ioredis. Mencakup string, hash, list, set, sorted set, stream, SCAN dan publish. Nilai aman untuk data biner, prefix key opsional memisahkan key milik plugin, dan panggilan tool agent hanya membaca kecuali kamu izinkan.
Yang bisa dilakukan
- Strings and keys: get, mget, set (EX/PX/NX/XX), del, exists, expire, ttl, incr, incrby.
- Hashes: hget, hset, hgetall, hdel.
- Lists: lpush, rpush, lrange, llen.
- Sets: sadd, smembers, srem.
- Sorted sets: zadd (NX/XX, GT/LT, CH) and zrange (by rank or by score, reverse, with scores), zrem.
- Keyspace: scan (cursor, MATCH, COUNT, TYPE). KEYS is never sent.
- Pub/sub: publish.
- Streams: xadd (MAXLEN ~, NOMKSTREAM), xrange (paged, reverse), xgroup_create, xreadgroup (never blocks) and xack.
Aksi
Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.
- Get value
redis.get - Get values
redis.mget - Set value
redis.set - Delete keys
redis.del - Keys exist
redis.exists - Set expiry
redis.expire - Time to live
redis.ttl - Increment
redis.incr - Increment by
redis.incrby - Get hash field
redis.hget
Tampilkan semua 31 aksi
- Set hash fields
redis.hset - Get all hash fields
redis.hgetall - Delete hash fields
redis.hdel - Push to list head
redis.lpush - Push to list tail
redis.rpush - List range
redis.lrange - List length
redis.llen - Add to set
redis.sadd - Set members
redis.smembers - Remove from set
redis.srem - Add to sorted set
redis.zadd - Sorted set range
redis.zrange - Remove from sorted set
redis.zrem - Scan keys
redis.scan - Publish message
redis.publish - Add stream entry
redis.xadd - Read stream range
redis.xrange - Read stream as consumer
redis.xreadgroup - Create consumer group
redis.xgroup_create - Acknowledge stream entries
redis.xack - Run Redis command
redis.command
Pengaturan
Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.
-
REDIS_URL(required)redis://[user]:password@host:6379/<db>, or rediss:// for TLS. A node's access_token (from a secret, with --trust-plugin redis) overrides it. The password is redacted from every error. -
REDIS_KEY_PREFIX(none)Added in front of every key and pub/sub channel, e.g. shop:, and stripped from keys returned by scan (see Safety) -
REDIS_TOOL_ALLOW_WRITES(off)1 lets agent tool calls run the write operations. Workflow nodes can always write. -
REDIS_MAX_VALUE_BYTES1048576Largest value one write may send, and the most bytes returned per value on reads (max 64 MiB) -
REDIS_MAX_RESULT_BYTES4194304Most bytes one read returns in total (max 8 MiB) -
REDIS_COMMAND_TIMEOUT_MS10000Time limit for each command (100 to 60000) -
REDIS_IDLE_MINUTES5Close the pooled connection after this many idle minutes
Cara memakainya
Di Graphrt Desktop
- Buka Plugins dan cari Redis.
- Klik Install lalu setujui.
- Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
- Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Dengan CLI
$ graphrt plugin install redis - { id: cache, type: redis.set, key: "quote:A-12", value: "{{#price.data.total#}}", ex: 3600 }
- { id: cached, type: redis.get, key: "quote:A-12" }
- { id: profile, type: redis.hset, key: "user:42", fields: { name: Budi, city: Bandung } }
- { id: events, type: redis.xadd, key: orders, fields: { order: A-12, status: paid }, max_length: 10000 }
- { id: work, type: redis.xreadgroup, key: orders, group: workers, consumer: graphrt-1, count: 10 }
- { id: done, type: redis.xack, key: orders, group: workers, ids: ["{{#work.data.entries.0.id#}}"] }
- { id: score, type: redis.command, command: ZSCORE, args: [leaderboard, budi] }