Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abargnesi/kyotocabinet-ffi
FFI wrapper to Kyoto Cabinet's C API.
https://github.com/abargnesi/kyotocabinet-ffi
Last synced: 7 days ago
JSON representation
FFI wrapper to Kyoto Cabinet's C API.
- Host: GitHub
- URL: https://github.com/abargnesi/kyotocabinet-ffi
- Owner: abargnesi
- License: mit
- Created: 2014-09-22T13:58:18.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-25T11:44:55.000Z (over 9 years ago)
- Last Synced: 2024-10-19T12:58:18.795Z (about 1 month ago)
- Language: Ruby
- Size: 223 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
[![Gem Version](https://badge.fury.io/rb/kyotocabinet-ffi.svg)](http://badge.fury.io/rb/kyotocabinet-ffi)
[![Build
Status](https://travis-ci.org/abargnesi/kyotocabinet-ffi.svg?branch=master)](https://travis-ci.org/abargnesi/kyotocabinet-ffi)kyotocabinet-ffi
================A FFI wrapper to the [Kyoto Cabinet](http://fallabs.com/kyotocabinet/)'s [C interface](http://fallabs.com/kyotocabinet/api/kclangc_8h.html).
Currently it provides the PolymorphicDb with MemoryHash and FileHash subclasses.
requirements
------------- Works on MRI (*>= 1.9.2*), JRuby (*1.9 mode*), and Rubinius.
- No runtime dependencies (except ffi gem on MRI).design
------- Supports polymorphic database with type-specific database classes for readability.
- Database classes can be treated like a ruby Hash.
- Common database calls (e.g. open, get, etc.) are provided in KyotoCabinet::Db.
- Methods ending with ``!`` can raise exceptions.
- Implemented using [FFI](https://github.com/ffi/ffi) to support MRI,
JRuby, and Rubinius.usage
-----```ruby
require 'kyotocabinet'# polymorphic database (e.g. determined by file_path)
db = KyotoCabinet::Db::PolymorphicDb.new(KyotoCabinet::MEMORY_CACHE_TREE, :reader, :writer, :create)# in-memory hash
db = KyotoCabinet::Db::MemoryHash.new(:reader, :writer, :create)# on-disk hash
db = KyotoCabinet::Db::FileHash.new("db", :reader, :writer, :create)begin
# set key/value record; create is needed
db['KyotoCabinet'] = 'FFI'
# get value for key
db['KyotoCabinet']
# => FFI# record count
db.size
# => 1# clear all records
db.clear
ensure
# close database; raise SystemCallError on failure
db.close! if db
end
```license
-------[MIT](http://opensource.org/licenses/MIT)