GithubHelp home page GithubHelp logo

golru's Introduction

GoLRU Cache Build Status

A light, high performance LRU cache package for Go, based on Concurrent-Map. This package have features as followed:

  • nearly LRU cache algorithm
  • use generic design,no need to serialize the struct or assert the type of interface.

usage

Import the package:

import (
	"github.com/lawyzheng/golru"
)
go get "github.com/lawyzheng/golru"

example

	// Create a new map.
	c := golru.New[string](0)

	// Sets item within map, sets "bar" under key "foo"
	c.Set("foo", "bar")

	// Retrieve item from map.
	bar, ok := c.Get("foo")

	// Removes item under key "foo"
	c.Remove("foo")

For more examples have a look at lru_test.go.

Running tests:

go test "github.com/lawyzheng/golru"

guidelines for contributing

Contributions are highly welcome. In order for a contribution to be merged, please follow these guidelines:

  • Open an issue and describe what you are after (fixing a bug, adding an enhancement, etc.).
  • According to the core team's feedback on the above mentioned issue, submit a pull request, describing the changes and linking to the issue.
  • New code must have test coverage.
  • If the code is about performance issues, you must include benchmarks in the process (either in the issue or in the PR).
  • In general, we would like to keep golru as simple as possible. Please keep this in mind when opening issues.

language

appreciation

Thanks for orcaman/concurrent-map to offer the basic idea.

license

MIT (see LICENSE file)

golru's People

Contributors

orcaman avatar lawyzheng avatar grudzinski avatar sillydong avatar redbaron avatar wxb avatar imvexed avatar flyingfoxlee avatar sgodeletatbunnings avatar swilly22 avatar karlseguin avatar icholy avatar michaelyou avatar whilei avatar bcho avatar tic8 avatar minecrafter avatar janisz avatar tsl0922 avatar rschmukler avatar qiaohao9 avatar pczajkowski avatar colega avatar komarov avatar mkrufky avatar zerozshadow avatar jobberrt avatar codelingobot avatar choleraehyq avatar bokub avatar

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.