Home > プログラムについて | 研究について > mrubyでRedis使うのはオーバースペックな人のためにmruby-vedis作った


以前mruby-redisを作ったのですが、mrubyでRedis使う場合に、inetとかunix domain socketで使えなくても良いし、サーバー機能無しでIn-Memoryにアプリケーションと同一プロセス上で動いたり、必要だったらOn-Diskぐらいで共有できる程度の軽量なKVSを使いたいなぁ、でもなんだかんだちょっとした事にRedis使いやすいしまぁRedis使うか、なんて思っている人はいると思います。




Vedis is an embeddable datastore C library built with over 70 commands similar in concept to Redis but without the networking layer since Vedis run in the same process of the host application.

Unlike most other datastores (i.e. memcache, Redis), Vedis does not have a separate server process. Vedis reads and writes directly to ordinary disk files. A complete database with multiple collections, is contained in a single disk file. The database file format is cross-platform, you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.

Vedis is a self-contained C library without dependency. It requires very minimal support from external libraries or from the operating system. This makes it well suited for use in embedded devices that lack the support infrastructure of a desktop computer. This also makes Vedis appropriate for use within applications that need to run without modification on a wide variety of computers of varying configurations.


  • Serverless, datastore engine.
  • Transactional (ACID) datastore.
  • Built with over 70 commands similar to the standard Redis commands.
  • Zero configuration.
  • Single database file, does not use temporary files.
  • Cross-platform file format.
  • Vedis is a Self-Contained C library without dependency.
  • Standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
  • Pluggable run-time interchangeable storage engine.
  • Support for on-disk as well in-memory datastore.
  • Thread safe and full reentrant.
  • Simple, Clean and easy to use API.
  • Support Terabyte sized databases.
  • Very high code quality, written in ANSI C, should compile and run unmodified in most platforms including restricted embedded devices with a C compiler.
  • Highly available online support.




# デフォルトはIn-Memory
v = Vedis.new

# On-Diskの場合はファイルを指定
# v = Vedis.new "/path/to/vedis.db"

# keyにはsymも使用可
v["test"] = "bbb"
v[:hoge] = 2
v[:foo] = 3
v.set :fuga, "aaa"

# exec
r1 = v.exec "MSET username james age 27 mail dude@example.com"
r2 = v.exec "MGET username age mail"

p v["test"]     #=> "bbb"
p v[:hoge]      #=> "2"
p v["foo"]      #=> "3"
p v.get :fuga   #=> "aaa"
p r1            #=> nil
p r2            #=> ["james", "27", "dude@example.com"]



Remember personal info


Listed below are links to weblogs that reference
mrubyでRedis使うのはオーバースペックな人のためにmruby-vedis作った from 人間とウェブの未来

Home > プログラムについて | 研究について > mrubyでRedis使うのはオーバースペックな人のためにmruby-vedis作った


Return to page top