goCacheIt

command module
v0.0.0-...-306e96d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2016 License: MIT Imports: 7 Imported by: 0

README

goCacheIt Travis CI

Basic in memory key-value store accessible by a HTTP RESTful interface, written in Go.

##Modules

  1. The module responsible for managing the key-value data structure. Main responsibilities include:
  2. Creation of the data structure at start-up
  3. Add a key-value couple
  4. Convert the JSON input to be stored as BSON
  5. Retrieve a value by key
  6. Convert the stored BSON to JSON
  7. The module managing the interface with external clients through a RESTful HTTP API which provides the following methods
  8. POST /api/store/ ⇒ MIME type application/json
  9. body { “key”: stringValue, “value”: { … } }
  10. GET /api/store/?key=my-key ⇒ accepting data type application/json . Result is just the value part {...}

##Implementation details

###Key-value store data structure goCacheIt uses a Splay-tree to store keys and values in memory. The advantage of using a Splay-tree is that frequently accessed nodes are much quicker to retrieve than less ones, making it perfect for a cache system similar. This should also allow for a faster LRU cache eviction policy, as least recently used nodes would obviously be at the bottom of the tree and we could therefore skip many checks in between the root and the leafs.

###Keys Keys are of type string and can have a max length of 255 chars.

###Values The value object is binary encoded as bson to keep spatial overhead to a minimum and consume as few memory resources as possible.

###Data structure details

type Tree struct {
  root *Node  
}
type Node struct {
  *parent, *left, *right Node,
  key string,
  value byte[]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/rcrowley/go-metrics
Go port of Coda Hale's Metrics library <https://github.com/rcrowley/go-metrics> Coda Hale's original work: <https://github.com/codahale/metrics>
Go port of Coda Hale's Metrics library <https://github.com/rcrowley/go-metrics> Coda Hale's original work: <https://github.com/codahale/metrics>
Metrics output to StatHat.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL