localcache

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: BSD-2-Clause Imports: 13 Imported by: 0

README

localcache GoDoc

import "github.com/guregu/localcache"

This is a DynamoDB wrapper that caches values in memory. Very experimental, don't use it.

Problems

  • This library has only been tested with guregu/dynamo, so it doesn't support things like KeyConditionExpression.
  • Projections don't work and will probably break lots of stuff.
  • Cache isn't configurable and doesn't expire properly.
  • Query cache for certain kinds of indexes won't be invalidated properly through certain operations

Perhaps one day I'll fix these!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithDB

func NewWithDB(client *dynamodb.DynamoDB) dynamodbiface.DynamoDBAPI

Types

type Cache

type Cache struct {
	*dynamodb.DynamoDB

	Debug bool
	// contains filtered or unexported fields
}

func (*Cache) Allow

func (c *Cache) Allow(table string)

func (*Cache) BatchGetItemWithContext

func (c *Cache) BatchGetItemWithContext(ctx aws.Context, input *dynamodb.BatchGetItemInput, opts ...request.Option) (*dynamodb.BatchGetItemOutput, error)

func (*Cache) BatchWriteItemWithContext

func (c *Cache) BatchWriteItemWithContext(ctx aws.Context, input *dynamodb.BatchWriteItemInput, opts ...request.Option) (*dynamodb.BatchWriteItemOutput, error)

func (*Cache) DeleteItemWithContext

func (c *Cache) DeleteItemWithContext(ctx aws.Context, input *dynamodb.DeleteItemInput, opts ...request.Option) (*dynamodb.DeleteItemOutput, error)

func (*Cache) GetItemWithContext

func (c *Cache) GetItemWithContext(ctx aws.Context, input *dynamodb.GetItemInput, opts ...request.Option) (*dynamodb.GetItemOutput, error)

func (*Cache) HitRatio

func (c *Cache) HitRatio() float64

func (*Cache) PurgeAll

func (c *Cache) PurgeAll()

func (*Cache) PutItemWithContext

func (c *Cache) PutItemWithContext(ctx aws.Context, input *dynamodb.PutItemInput, opts ...request.Option) (*dynamodb.PutItemOutput, error)

func (*Cache) QueryWithContext

func (c *Cache) QueryWithContext(ctx aws.Context, input *dynamodb.QueryInput, opts ...request.Option) (*dynamodb.QueryOutput, error)

func (*Cache) ScanWithContext

func (c *Cache) ScanWithContext(ctx aws.Context, input *dynamodb.ScanInput, opts ...request.Option) (*dynamodb.ScanOutput, error)

func (*Cache) TransactWriteItemsWithContext

func (c *Cache) TransactWriteItemsWithContext(ctx aws.Context, input *dynamodb.TransactWriteItemsInput, opts ...request.Option) (*dynamodb.TransactWriteItemsOutput, error)

func (*Cache) UpdateItemWithContext

func (c *Cache) UpdateItemWithContext(ctx aws.Context, input *dynamodb.UpdateItemInput, opts ...request.Option) (*dynamodb.UpdateItemOutput, error)

Jump to

Keyboard shortcuts

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