Skip to content

jiansoft/carrot

Repository files navigation

carrot

GitHub Go Report Card build-test

Features

Memory Cache

Implements an in-memory cache key:value (similar to C# MemoryCache)

Usage

Quick Start

1.Install

  go get github.com/jiansoft/carrot

2.Use examples

import (
    "time"
    
    "github.com/jiansoft/carrot"
)

func main() {
    
    //Keep an item in memory 
    carrot.Default.Delay("qq", "Qoo", time.Second)
    //Read returns the value if the key exists in the cache and it's not expired.
    val, ok := carrot.Default.Read("qq")
    //Have eturns true if the memory has the item and it's not expired.
    yes := carrot.Default.Have("qq")
    //Removes an item from the memory
    carrot.Default.Forget("qq")

More example

License

Copyright (c) 2023

Released under the MIT license:

About

carrot provides a high performance in-memory cache for humans.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages