tokyotyrant-haskell-1.0.1: FFI bindings to libtokyotyrant

Database.TokyoTyrant.FFI

Contents

Description

This module provides a thin FFI binding to the libtokyotyrant C library shipped with Mikio Hirabayashi's Tokyo Tyrant. (http://tokyocabinet.sourceforge.net/tyrantdoc/)

It's intended to be imported qualified, e.g.: import qualified Database.TokyoTyrant.FFI as TT

Synopsis

Opening/closing connections

openSource

Arguments

:: ByteString

hostname

-> Int

port

-> IO (Either String Connection) 

Open a connection to Tokyo Tyrant.

close :: Connection -> IO ()Source

Close a connection to Tokyo Tyrant

Fetching/storing single values from the store

getSource

Arguments

:: Connection

connection

-> ByteString

key

-> IO (Either String (Maybe ByteString)) 

Get a value from the database

putSource

Arguments

:: Connection

connection

-> ByteString

key

-> ByteString

value

-> IO (Either String ()) 

Store a value in the database (destructive, overwrites any existing value)

putKeepSource

Arguments

:: Connection

connection

-> ByteString

key

-> ByteString

value

-> IO (Either String ()) 

Store a value in the database (non-destructive, does nothing if the key already exists)

Fetching/storing multiple values from the store

mgetSource

Arguments

:: Connection

connection to DB

-> [ByteString]

list of keys to fetch

-> IO (Either String [(ByteString, ByteString)]) 

Get multiple values from the database. On success, returns `Right kvps`.

mputSource

Arguments

:: Connection

connection to DB

-> [(ByteString, ByteString)]

list of key-value pairs

-> IO (Either String ()) 

Put multiple values to the database.

Deleting keys

deleteSource

Arguments

:: Connection

connection

-> ByteString

key

-> IO (Either String ()) 

Delete a value from the DB

vanish :: Connection -> IO (Either String ())Source

Delete all KVPs in the database.

Key prefix search

fwmkeysSource

Arguments

:: Connection

connection to DB

-> ByteString

key prefix

-> Int

max # of returned keys; negative numbers mean no limit

-> IO (Either String [ByteString]) 

Search keys by prefix. Returns a list of matching keys.

Types

data Connection Source

A Tokyo Tyrant connection type. Wraps the TCRDB type from the C library.