sluggo

command module
v0.0.0-...-1de58c0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 4 Imported by: 0

README

sluggo

What is this?

Sluggo is a simple cache server with a very small API, no automatic eviction and no high-watermark for memory usage. Sluggo uses string keys for clarity, but this should probably be updated internally to use something like xxhash to create unique uint64 keys for speed(?) and key structure consistency.

I wrote this quickly to support some testing I was working on; don't use sluggo for anything important.

Use

go run main.go -a 192.168.1.40:7070

API

The caller API is contained in the wscl package and consists of three discrete functions as shown in the following code snippet:


    func AddUpdCacheEntry(key string, i interface{}, address string) error {}
    func GetCacheEntry(key string, i interface{}, address string) error {}
    func RemoveCacheEntry(key string, address string) error {}

Interface{} is used as a passing/receiving reference-type parameter in order to allow any data to be placed into the cache.

It is the responsibility of the caller to determine the best way to use the API. i.e. call with a static-type, or call with interface-type (read-case) and then perform a type-assertion.

The Sluggo client API establishes a new web-socket connection for each call. Again; not the sort of thing that would be desirable in a real-world scenario. It would be simple to adjust the client to hold a connection, but if one were going to make that effort, an effort should also be made to adjust the entire codebase to use the gorilla web-sockets implementation over that of the golang stdlib. Gorilla does some things better.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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