Giter Site home page Giter Site logo

bucket's Introduction

MIT licensed Build Status Coverage Status GoDoc Documentation

Features

  • In-Memory or Redis based storage
  • Concurrency-safe
  • Put, Take, Count, DynamicFill, and many more primitives
  • Designed for distributed systems
  • Well tested
  • Well documented

Install

go get github.com/b3ntly/bucket

Documentation

Can be found here

Notes

  • Test coverage badge is stuck in some cache and is out of date, click the badge to see the actual current coverage

Changelog for version 0.2

  • Abstracted storage to its own interface, see storage.go and redis.go for examples
  • Added in-memory storage option
  • Replaced storageOptions parameter with IStorage, allowing a single storage option to be shared between multiple buckets. This should make it much more efficient to have a large number of buckets, i.e. per logged in user.

Changelog for version 0.3

  • Renamed the repository from distributed-token-bucket to bucket
  • Moved storage interface and providers to the /storage subpackage
  • Added unit testing to the /storage subpackage
  • Added watchable.go and changed signatures of all async functions to return a watchable
  • Fixed examples
  • Added more documentation and comments

Changelog for version 0.4

  • Shortened "constructor" names
  • Default options
  • Better "constructor" signatures
  • bucket.DynamicFill()
  • bucket.TakeAll()

Changelog for version 0.5

  • Added full documentation via Hugo

Benchmarks

go test -bench .

Benchmarks were done on a 2.2GHz quad-core Intel Core i7 with 16GB of RAM.

Version 0.4

Memory

Benchmark Operations ns/op
BenchmarkBucket_Create-8 10000 715 ns/op
BenchmarkBucket_Take-8 30000 132 ns/op
BenchmarkBucket_Put-8 50000 142 ns/op

Redis

Benchmark Operations ns/op
BenchmarkBucket_Create-8 10000 98582 ns/op
BenchmarkBucket_Take-8 30000 47716 ns/op
BenchmarkBucket_Put-8 50000 31350 ns/op

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.