file

package
v0.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 10 Imported by: 27

README

Cachego - File driver

The driver stores the cache data in file.

Usage

package main

import (
	"log"
	"time"

	"github.com/faabiosr/cachego/file"
)

func main() {
	cache := file.New("./cache-dir/")

	if err := cache.Save("user_id", "1", 10*time.Second); err != nil {
		log.Fatal(err)
	}

	id, err := cache.Fetch("user_id")
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("user id: %s \n", id)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(dir string) cachego.Cache

New creates an instance of File cache

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL