Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

go-cache

> 编程语言
Open source

An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

8.8K stars0 likes1 views
WebsiteGitHub

About

An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache

go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major advantage is that, being essentially a thread-safe map[string]interface{} with expiration times, it doesn't need to serialize or transmit its contents over the network.

Any object can be stored, for a given duration or forever, and the cache can be safely used by multiple goroutines.

Although go-cache isn't meant to be used as a persistent datastore, the entire cache can be saved to and loaded from a file (using c.Items() to retrieve the items map to serialize, and NewFrom() to create a cache from a deserialized one) to recover from downtime quickly. (See the docs for NewFrom() for caveats.)

Installation

go get github.com/patrickmn/go-cache

Usage

…

Reference

godoc or http://godoc.org/github.com/patrickmn/go-cache

Issues· 80 open

View all issuesOpen on GitHub
  • #187

    Is comment correctly reflecting logic?

    Updated Oct 14, 2025
  • #182

    Is there an expiration hook function?

    Updated Apr 24, 2025
  • #185

    Using testing/synctest on cache with janitor goroutine will hang forever

    Updated Mar 18, 2025
  • #184

    New lib using your lib

    Updated Jan 14, 2025
  • #179

    Add new method GetItemsAndFlush

    Updated Sep 12, 2024
  • #136

    can you release a version?

    Updated Jul 3, 2024
  • #176

    OnEvicted is not called for every expired value

    Updated Jul 3, 2024
  • #177

    go incompatible version

    Updated Jul 3, 2024
  • #173

    Proposal to Integrate SIEVE Eviction Algorithm

    Updated Dec 26, 2023
  • #169

    Introduce pattern-based Keys and Scan functions

    Updated Sep 27, 2023

> Tags

Gocachegolibrary

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言