兼容 Redis 的嵌入式 NoSQL 引擎:rlite
rlite 是一個自托管、無服務端、零配置、支持事務和兼容 Redis 的數據庫引擎。rlite 對于 Redis 就好像 SQLite 對于 SQL。
使用場景:
-
Mobile. If you are used to Redis data structure, and it is better suited for your mobile application than sqlite, you can use rlite as a database.
-
Replace Redis in development stack. By being embedded, rlite does not need a separate database process, and since it is compatible with Redis you can use it while developing, even if you use Redis instead in production.
-
Replace Redis in tests. The test stack can use rlite instead of Redis if you use the latter in production. It can simplify the CI stack, and the distribution of fixtures by being in binary form, and it will not require to load completely in memory to run each test.
-
Slave of Redis. You can run rlite-server as a slave of a master Redis instance. It works as third alternative to Redis's snapshot and append-only file.
-
Store client-side application data. Alternatively to a propetary format or sqlite, command line or simple applications can store its data using rlite.
示例代碼:
require('redis') require('hirlite/connection') redis = Redis.new(:host => ":memory:", :driver => Rlite::Connection::Hirlite) redis.set 'key', 'value' p redis.get 'key' # value