aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorMarc Pervaz Boocha <marcpervaz@qburst.com>2025-04-08 16:15:27 +0530
committerMarc Pervaz Boocha <marcpervaz@qburst.com>2025-04-08 16:15:27 +0530
commitebb2dc540858155152b21549afd77e65118e1474 (patch)
tree74aa4929bb8dfd9a1823baa0b56cecadd99e91b4 /README.md
parentAdded documentation and tests (diff)
downloadcache-ebb2dc540858155152b21549afd77e65118e1474.tar
cache-ebb2dc540858155152b21549afd77e65118e1474.tar.gz
cache-ebb2dc540858155152b21549afd77e65118e1474.tar.bz2
cache-ebb2dc540858155152b21549afd77e65118e1474.tar.lz
cache-ebb2dc540858155152b21549afd77e65118e1474.tar.xz
cache-ebb2dc540858155152b21549afd77e65118e1474.tar.zst
cache-ebb2dc540858155152b21549afd77e65118e1474.zip
Lint and bug fixes
Diffstat (limited to 'README.md')
-rw-r--r--README.md16
1 files changed, 13 insertions, 3 deletions
diff --git a/README.md b/README.md
index f4dba3a..6d0054c 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,13 @@
# Cache
+An deamonless in-memory caching library with persistant snapshots.
+
## Features
- **In-Memory Cache**: Fast access to cached data.
- **Uses Generics with serialization**: To make it type safe and support several types via msgpack.
-s
+
- **File-Backed Storage**: Persistent storage of cache data.
- **Eviction Policies**: Support for FIFO, LRU, LFU, and LTR eviction policies.
@@ -86,13 +88,21 @@ func main() {
}
// Get a value by key
-
value, ttl, err := db.GetValue("key")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Value: %s, TTL: %v\n", value, ttl)
+
+ // Get a value with a pointer by key(Useful if the value type is an interface).
+ var value string
+ value, ttl, err := db.GetValue(&value)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Printf("Value: %s, TTL: %v\n", value, ttl)
}
```
@@ -128,7 +138,7 @@ The Cache Library supports the following configuration options:
### Additional Methods
-- `Get`: Retrieves a value from the cache by key and returns its TTL.
+- `Get`: Retrieves a value from the cache by key and returns its TTL. It take an out pointer.
- `GetValue`: Retrieves a value from the cache by key and returns the value and its TTL.