Skip to content
/ disk Public

🌵 base on cachego/cache implementation disk cache

Notifications You must be signed in to change notification settings

cachego/disk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache-disk

refer to cachego/cache

Install

go module

Use go module directly import:

import "github.com/cachego/disk"

go get

Use go get to install:

go get github.com/cachego/disk

Demo

Complete example

1. cache demo

code reference:

package main

import (
	"fmt"

	cache "github.com/cachego/disk"
)

func main() {
	key := "key1"
	c := cache.NewInDiskStrCache(".cache")
	c.Set(key, "cache value", 0)
	v, err := c.Get(key)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(v) // cache value
	c.Del(key)
	v, err = c.Get(key)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(v) // nil
	c.Clear()
}

output:

cache value
<nil>

About

🌵 base on cachego/cache implementation disk cache

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages