[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5127":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},5127,"go-cache","patrickmn\u002Fgo-cache","patrickmn","An in-memory key:value store\u002Fcache (similar to Memcached) library for Go, suitable for single-machine applications.","https:\u002F\u002Fpatrickmn.com\u002Fprojects\u002Fgo-cache\u002F",null,"Go",8827,904,112,43,0,3,17,1,39.87,"MIT License",false,"master",true,[26,27,28],"cache","go","library","2026-06-12 02:01:08","# go-cache\n\ngo-cache is an in-memory key:value store\u002Fcache similar to memcached that is\nsuitable for applications running on a single machine. Its major advantage is\nthat, being essentially a thread-safe `map[string]interface{}` with expiration\ntimes, it doesn't need to serialize or transmit its contents over the network.\n\nAny object can be stored, for a given duration or forever, and the cache can be\nsafely used by multiple goroutines.\n\nAlthough go-cache isn't meant to be used as a persistent datastore, the entire\ncache can be saved to and loaded from a file (using `c.Items()` to retrieve the\nitems map to serialize, and `NewFrom()` to create a cache from a deserialized\none) to recover from downtime quickly. (See the docs for `NewFrom()` for caveats.)\n\n### Installation\n\n`go get github.com\u002Fpatrickmn\u002Fgo-cache`\n\n### Usage\n\n```go\nimport (\n\t\"fmt\"\n\t\"github.com\u002Fpatrickmn\u002Fgo-cache\"\n\t\"time\"\n)\n\nfunc main() {\n\t\u002F\u002F Create a cache with a default expiration time of 5 minutes, and which\n\t\u002F\u002F purges expired items every 10 minutes\n\tc := cache.New(5*time.Minute, 10*time.Minute)\n\n\t\u002F\u002F Set the value of the key \"foo\" to \"bar\", with the default expiration time\n\tc.Set(\"foo\", \"bar\", cache.DefaultExpiration)\n\n\t\u002F\u002F Set the value of the key \"baz\" to 42, with no expiration time\n\t\u002F\u002F (the item won't be removed until it is re-set, or removed using\n\t\u002F\u002F c.Delete(\"baz\")\n\tc.Set(\"baz\", 42, cache.NoExpiration)\n\n\t\u002F\u002F Get the string associated with the key \"foo\" from the cache\n\tfoo, found := c.Get(\"foo\")\n\tif found {\n\t\tfmt.Println(foo)\n\t}\n\n\t\u002F\u002F Since Go is statically typed, and cache values can be anything, type\n\t\u002F\u002F assertion is needed when values are being passed to functions that don't\n\t\u002F\u002F take arbitrary types, (i.e. interface{}). The simplest way to do this for\n\t\u002F\u002F values which will only be used once--e.g. for passing to another\n\t\u002F\u002F function--is:\n\tfoo, found := c.Get(\"foo\")\n\tif found {\n\t\tMyFunction(foo.(string))\n\t}\n\n\t\u002F\u002F This gets tedious if the value is used several times in the same function.\n\t\u002F\u002F You might do either of the following instead:\n\tif x, found := c.Get(\"foo\"); found {\n\t\tfoo := x.(string)\n\t\t\u002F\u002F ...\n\t}\n\t\u002F\u002F or\n\tvar foo string\n\tif x, found := c.Get(\"foo\"); found {\n\t\tfoo = x.(string)\n\t}\n\t\u002F\u002F ...\n\t\u002F\u002F foo can then be passed around freely as a string\n\n\t\u002F\u002F Want performance? Store pointers!\n\tc.Set(\"foo\", &MyStruct, cache.DefaultExpiration)\n\tif x, found := c.Get(\"foo\"); found {\n\t\tfoo := x.(*MyStruct)\n\t\t\t\u002F\u002F ...\n\t}\n}\n```\n\n### Reference\n\n`godoc` or [http:\u002F\u002Fgodoc.org\u002Fgithub.com\u002Fpatrickmn\u002Fgo-cache](http:\u002F\u002Fgodoc.org\u002Fgithub.com\u002Fpatrickmn\u002Fgo-cache)\n","go-cache 是一个适用于单机应用的内存键值存储\u002F缓存库，类似于 Memcached。其核心功能包括线程安全的键值映射支持以及自动过期机制，无需序列化或网络传输数据。任何对象都可以被存储，并设置特定的存活时间或者永久保存，且该缓存可以在多个 goroutine 中安全使用。此外，尽管 go-cache 并非设计为持久化存储解决方案，但整个缓存内容可以保存到文件中并在需要时恢复，从而快速从停机状态恢复。此项目非常适合那些需要在单一机器上实现高效缓存管理的应用场景，如Web服务、API响应缓存等。",2,"2026-06-11 03:02:39","top_language"]