Skip to content
/ filecache Public

A golang filecache used directly with default setting. Based on ——

Notifications You must be signed in to change notification settings

vcgo/filecache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

filecache

A golang filecache used directly with default setting. Based on —— https://github.com/huntsman-li/go-cache

How To Use

go get github.com/vcgo/filecache
package main

import (
	"fmt"
	"time"

	. "github.com/vcgo/filecache"
)

func main() {
	Cache.Put("github.com/wilon", 2333, 5)
	for i := 0; i < 10; i++ {
		fmt.Println("...", Cache.Get("github.com/wilon"))
		time.Sleep(time.Duration(1000) * time.Millisecond)
	}
}

And more func——

	// Put puts value into cache with key and expire time.
	Put(key string, val interface{}, timeout int64) error
	// Get gets cached value by given key.
	Get(key string) interface{}
	// Delete deletes cached value by given key.
	Delete(key string) error
	// Incr increases cached int-type value by given key as a counter.
	Incr(key string) error
	// Decr decreases cached int-type value by given key as a counter.
	Decr(key string) error
	// IsExist returns true if cached value exists.
	IsExist(key string) bool
	// Flush deletes all cached data.
	Flush() error
	// StartAndGC starts GC routine based on config string settings.
	StartAndGC(opt Options) error

Test

go run example/cache.go

More requirements?

Just use https://github.com/huntsman-li/go-cache.

About

A golang filecache used directly with default setting. Based on ——

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages