Middleware de cache para aplicações Go baseadas no roteador Chi.
Encontrar um arquivo
Arquivos do repositório (último commit primeiro)
Nome de arquivo Última mensagem de commit Última data de commit
2026-08-13 18:05:42 +00:00
.forgejo/workflows Update https://data.forgejo.org/golangci/golangci-lint-action action to v9.3.0 (#68) 2026-07-14 23:20:17 +00:00
memcache Update module golangci-lint to v2.6.0 (#37) 2025-10-31 23:43:13 +00:00
.golangci.yaml Update module golangci-lint to v2.6.0 (#37) 2025-10-31 23:43:13 +00:00
cache.go [REFACTOR] Use any 2024-08-26 19:43:31 +02:00
cache_test.go [PORT] Ignore not exist key with memcache (gitea#17) 2024-09-12 12:36:40 +02:00
go.mod Update go toolchain directive to v1.26.6 (#70) 2026-08-13 18:05:42 +00:00
go.sum Update github.com/bradfitz/gomemcache digest to 4d751bb (#66) 2026-07-14 23:18:48 +00:00
LICENSE Initial commit 2014-07-15 18:38:44 -04:00
memory.go [FEAT] Make it data-race proof 2024-08-27 21:21:27 +02:00
memory_test.go [CHORE] Add lint 2024-08-26 19:37:33 +02:00
README.md [CHORE] Branding 2024-08-26 06:05:21 +02:00
renovate.json chore(renovate): use shared org preset 2024-11-07 15:29:16 +01:00
utils.go [CHORE] Remove unused cache adapters 2024-08-26 06:05:17 +02:00

cache

cache is a middleware that aim to have a transparent interface for a lot of cache implementations.

Use use many cache adapters, including memory and Memcache.

Installation

go get code.forgejo.org/go-chi/cache

Getting Help

// Cache is the interface that operates the cache data.
type Cache interface {
	// Put puts value into cache with key and expire time.
	Put(key string, val any, timeout int64) error
	// Get gets cached value by given key.
	Get(key string) any
	// Delete deletes cached value by given key.
	Delete(key string) error
	// Incr increases cached int-type value by given key as a counter.
	Incr(key string) error
	// Decr decreases cached int-type value by given key as a counter.
	Decr(key string) error
	// IsExist returns true if cached value exists.
	IsExist(key string) bool
	// Flush deletes all cached data.
	Flush() error
	// StartAndGC starts GC routine based on config string settings.
	StartAndGC(opt Options) error
	// Ping tests if the cache is alive
	Ping() error
}

Credits

This package is a modified version of go-chi/cache which is a modified version of go-macaron/cache.

License

This project is under the Apache License, Version 2.0. See the LICENSE file for the full license text.