Documentation

Overview

Package gcs provides cache service by google cloud storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdmissionController

type AdmissionController interface {
	AdmitPut(context.Context, *pb.PutReq) error
}

AdmissionController checks incoming request.

type Cache

type Cache struct {
	pb.UnimplementedCacheServiceServer

	AdmissionController AdmissionController
	// contains filtered or unexported fields
}

Cache represents key-value cache using google cloud storage.

func New

func New(bkt *storage.BucketHandle) *Cache

New creates new cache.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, in *pb.GetReq) (*pb.GetResp, error)

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, in *pb.PutReq) (*pb.PutResp, error)

func (*Cache) Stats

func (c *Cache) Stats() Stats

type Stats

type Stats struct {
	Hits int64
	Gets int64
}

Stats represents stats of gcs.Cache. TODO: use opencensus stats, view.

Source Files