travisbrady / haskell-tyrant

A pure Haskell interface to the Tokyo Tyrant database server via its binary protocol

This URL has Read+Write access

name age message
file .gitignore Wed Mar 18 15:04:27 -0700 2009 add license, readme, setup and cabal stuff [Travis Brady]
directory Database/ Sun May 17 19:28:47 -0700 2009 Ensure that openConnection creates the proper s... [korpios]
file LICENSE Wed Mar 18 15:04:27 -0700 2009 add license, readme, setup and cabal stuff [Travis Brady]
file README.md Thu Mar 19 12:22:31 -0700 2009 fix typo in README [Travis Brady]
file Setup.hs Wed Mar 18 15:04:27 -0700 2009 add license, readme, setup and cabal stuff [Travis Brady]
file haskell-tyrant.cabal Thu Apr 16 19:24:43 -0700 2009 update to work with Network.ByteString.Lazy fro... [Travis Brady]
directory tests/ Thu Mar 19 12:32:22 -0700 2009 cleanup [Travis Brady]
README.md

Pure Haskell interface to Tokyo Tyrant

haskell-tyrant lets you connect to ttserver

Example

A simple example assuming you've got ttserver running at the default location

module Main where

import Database.TokyoTyrant
import Data.ByteString.Lazy.Char8 (pack)

defaultHost = "localhost"
defaultPort = "1978"

main = do
    let k = pack "mykey"
    let v = pack "myval"
    conn <- openConnection defaultHost defaultPort
    result <- putValue conn k v
    --should be "success"
    print result
    g <- getValue conn k
    print g
    -- remove the record created above
    out conn k
    -- close connection to server
    closeConnection conn