Skip to content

1414C/sluggo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages