a simple pure ruby implement in-memory database~
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md

README.md

SimplexDB

a simple pure ruby implement in-memory database~ you can use it as a embedded database or as a service. it use append only file to persist data on disk

inspired by The Great Code Club.

features

  • search with index
  • range search
  • store data in append only file
  • embedded in ruby application
  • use as a service with tcp connection (not implement yet)
  • pure ruby implementation

usage

require 'simplexdb'

setting = 
{
  default_index_degree: 10,
  components:
  {
    aof_storage:
    {
      filename: 'aof.txt',
      save_interval: 0
    }
  }
}

database = SimplexDB::Database.create(setting)
table = database.create_table(:my_table)

table.index :my_key

1000.times do |i|
  table.insert my_key: i, value: 'abc'
end

result = table.search(:my_key, 10)
range_result = table.range_search(:my_key, 980, nil)