Go 语言的缓存框架 go-cache

码农软件 · 软件分类 · 缓存系统 · 2019-08-30 14:43:04

软件介绍

go-cache 是 Go 语言实现的一个内存中的缓存框架,实现 Key-Value 的序列存储。

示例代码:

import "github.com/pmylund/go-cache"

// Create a cache with a default expiration time of 5 minutes, and which
// purges expired items every 30 seconds
c := cache.New(5*time.Minute, 30*time.Second)

// Set the value of the key "foo" to "bar", with the default expiration time
c.Set("foo", "bar", 0)

// Set the value of the key "baz" to "yes", with no expiration time
// (the item won't be removed until it is re-set, or removed using
// c.Delete("baz")
c.Set("baz", "yes", -1)

// Get the string associated with the key "foo" from the cache
foo, found := c.Get("foo")
if found {
        fmt.Println(foo)
}

本文地址:https://codercto.com/soft/d/13503.html

互联网黑洞

互联网黑洞

仲昭川 / 电子工业出版社 / 2014-4 / 50.00

万物之灵,存乎一心;互联网时代,上兵伐谋。 纵横古今商业奥秘,无非兴趣与利益、诱惑与满足、成本与利润、价格与价值。 本书着眼于大互联网时代,旨在通过对时下互联网圈子的冷静分析、传奇披露、实战揭秘,进而传授互联网哲学,阐述互联网现状,揭示互联网价值,尝试为互联网的未来探寻狭窄的通道。一起来看看 《互联网黑洞》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码