All Projects → goburrow → Cache

goburrow / Cache

Licence: other
Mango Cache 🥭 - Partial implementations of Guava Cache in Go.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Cache

Cache
Cache library
Stars: ✭ 310 (-16.67%)
Mutual labels:  cache
Compoxure
Proxy middleware for express that enables composition of microservices.
Stars: ✭ 332 (-10.75%)
Mutual labels:  cache
Django Watchman
django-watchman exposes a status endpoint for your backing services like databases, caches, etc.
Stars: ✭ 357 (-4.03%)
Mutual labels:  cache
Apex Recipes
A library of concise, meaningful examples of Apex code for common use cases following best practices.
Stars: ✭ 307 (-17.47%)
Mutual labels:  cache
Cache
The Cache component provides an extended PSR-6 implementation for adding cache to your applications.
Stars: ✭ 3,606 (+869.35%)
Mutual labels:  cache
Hibernate Redis
hibernate 2nd level cache privder using redis
Stars: ✭ 345 (-7.26%)
Mutual labels:  cache
Senparc.co2net
支持 .NET Framework & .NET Core 的公共基础扩展库
Stars: ✭ 289 (-22.31%)
Mutual labels:  cache
Uitableviewdynamiclayoutcacheheight
🖖高性能的自动计算采用 Autolayout 布局的 UITableViewCell 和 UITableViewHeaderFooterView 的高度,内部自动管理高度缓存。
Stars: ✭ 360 (-3.23%)
Mutual labels:  cache
Daisynet
1. - Alamofire与Cache封装 , 更容易存储请求数据. 2. - 封装Alamofire下载,使用更方便
Stars: ✭ 331 (-11.02%)
Mutual labels:  cache
Ssm booksystem
ssm demo,ssm详细教程,SSM简明教程:简单的十步教你搭建人生第一个SSM框架[ SSM框架整合教程(spring+spring mvc+mybatis+redis+maven+idea+bootstrap) ]
Stars: ✭ 355 (-4.57%)
Mutual labels:  cache
Fwplayer
A video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://fokswang.wixsite.com/home
Stars: ✭ 321 (-13.71%)
Mutual labels:  cache
Guzzle Cache Middleware
A HTTP Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack.
Stars: ✭ 325 (-12.63%)
Mutual labels:  cache
Net
Android上强大的网络请求
Stars: ✭ 344 (-7.53%)
Mutual labels:  cache
Javatech
☕️ 汇总 Java 开发中常见的主流技术的应用、特性、原理。
Stars: ✭ 310 (-16.67%)
Mutual labels:  cache
Cachier
Persistent, stale-free, local and cross-machine caching for Python functions.
Stars: ✭ 359 (-3.49%)
Mutual labels:  cache
Easystash
🗳Easy data persistence in Swift
Stars: ✭ 303 (-18.55%)
Mutual labels:  cache
Cache
Cache library with Redis backend for Golang
Stars: ✭ 337 (-9.41%)
Mutual labels:  cache
Lesti fpc
Simple Magento Fullpagecache
Stars: ✭ 362 (-2.69%)
Mutual labels:  cache
Cashew
🐿 A flexible and straightforward library that caches HTTP requests in Angular
Stars: ✭ 355 (-4.57%)
Mutual labels:  cache
Kache
A simple in memory cache written using go
Stars: ✭ 349 (-6.18%)
Mutual labels:  cache

Mango Cache

GoDoc Go

Partial implementations of Guava Cache in Go.

Supported cache replacement policies:

  • LRU
  • Segmented LRU (default)
  • TinyLFU (experimental)

The TinyLFU implementation is inspired by Caffeine by Ben Manes and go-tinylfu by Damian Gryski.

Download

go get -u github.com/goburrow/cache

Example

package main

import (
	"fmt"
	"math/rand"
	"time"

	"github.com/goburrow/cache"
)

func main() {
	load := func(k cache.Key) (cache.Value, error) {
		time.Sleep(100 * time.Millisecond) // Slow task
		return fmt.Sprintf("%d", k), nil
	}
	// Create a loading cache
	c := cache.NewLoadingCache(load,
		cache.WithMaximumSize(100),                 // Limit number of entries in the cache.
		cache.WithExpireAfterAccess(1*time.Minute), // Expire entries after 1 minute since last accessed.
		cache.WithRefreshAfterWrite(2*time.Minute), // Expire entries after 2 minutes since last created.
	)

	getTicker := time.Tick(100 * time.Millisecond)
	reportTicker := time.Tick(5 * time.Second)
	for {
		select {
		case <-getTicker:
			_, _ = c.Get(rand.Intn(200))
		case <-reportTicker:
			st := cache.Stats{}
			c.Stats(&st)
			fmt.Printf("%+v\n", st)
		}
	}
}

Performance

See traces and benchmark

report

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].