1
0
Fork 0
Find a file
Daniel Baumann 4f1c6ed221
Releasing debian version 1.0.1-1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-05-26 05:49:54 +02:00
.forgejo/workflows Merging upstream version 1.0.1. 2025-05-26 05:49:46 +02:00
debian Releasing debian version 1.0.1-1. 2025-05-26 05:49:54 +02:00
memcache Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
.golangci.yaml Merging upstream version 1.0.1. 2025-05-26 05:49:46 +02:00
cache.go Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
cache_test.go Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
go.mod Merging upstream version 1.0.1. 2025-05-26 05:49:46 +02:00
go.sum Merging upstream version 1.0.1. 2025-05-26 05:49:46 +02:00
LICENSE Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
memory.go Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
memory_test.go Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
README.md Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
renovate.json Adding upstream version 1.0.0. 2025-05-18 14:17:55 +02:00
utils.go Adding upstream version 1.0.0. 2025-05-18 14:17:55 +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.