golib/gcache/readme.adoc

29 lines
445 B
Plaintext

= 说明
:author: tiglog
:experimental:
:toc: left
:toclevels: 3
:toc-title: 目录
:sectnums:
:icons: font
:!webfonts:
:autofit-option:
:source-highlighter: rouge
:rouge-style: github
:source-linenums-option:
:revdate: 2023-10-11
:imagesdir: ./img
== 快速使用
[source,go]
----
c := cache.NewMemCache()
c.Set("a", 1)
c.Set("b", 1, cache.WithEx(1*time.Second))
time.sleep(1*time.Second)
c.Get("a") // 1, true
c.Get("b") // nil, false
----