grpc-cache

module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT

README

Implementation of a simple cache via gRPC.

This package implements a client and server to create a cache that exchanges data via gRPC.

Example Usage Server

import gS "github.com/TryPerzh/grpc-cache/server"

var server *gS.Server

server = gS.NewWithConfig(gS.Config{
     Port:                   "8080",
     DefaultCacheExpiration: 24 * time.Hour,
     CleanupCacheInterval:   10 * time.Minute,
})
server.Tokens.AddUser("testlogin", "testpassword")
server.RunServer()

Example Usage Client

import gC "github.com/TryPerzh/grpc-cache/client"

var client *gC.CacheClient

client = gC.New("localhost", "8080", "testlogin", "testpassword")
client.Connect()

client.Set("1", "data", time.Hour) //key, value, storage time

value, f := client.Get("1")
if f {
	fmt.Println(value)
}

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

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