datastore: Index | Examples | Files

package aememcache

import ""

Package aememcache handles Put, Get etc to Datastore and provides caching by AppEngine's Memcache. How the cache is used is explained in the storagecache package's document.

Related document.


package main

import (


func appengineContext() (ctx context.Context, cancelFn func() error) {
    inst, err := aetest.NewInstance(&aetest.Options{StronglyConsistentDatastore: true, SuppressDevAppServerLog: true})
    if err != nil {
    cancelFn = inst.Close
    r, err := inst.NewRequest("GET", "/", nil)
    if err != nil {
    ctx = appengine.NewContext(r)


func main() {
    ctx, cancelFn := appengineContext()
    go cancelFn()

    client, err := aedatastore.FromContext(ctx)
    if err != nil {
    defer client.Close()

    mw := aememcache.New()



Package Files

aememcache.go doc.go option.go

func New Uses

func New(opts ...CacheOption) interface {

New AE Memcache middleware creates & returns.

type CacheOption Uses

type CacheOption interface {

A CacheOption is an cache option for a AE Memcache middleware.

func WithCacheKey Uses

func WithCacheKey(f func(key datastore.Key) string) CacheOption

WithCacheKey creates a ClientOption that specifies how to generate a cache key from datastore.Key.

func WithExcludeKinds Uses

func WithExcludeKinds(kinds ...string) CacheOption

WithExcludeKinds creates a ClientOption that selects the Kind unspecified as the cache target.

func WithExpireDuration Uses

func WithExpireDuration(d time.Duration) CacheOption

WithExpireDuration creates a ClientOption to expire at a specified time.

func WithIncludeKinds Uses

func WithIncludeKinds(kinds ...string) CacheOption

WithIncludeKinds creates a ClientOption that selects the Kind specified as the cache target.

func WithKeyFilter Uses

func WithKeyFilter(f storagecache.KeyFilter) CacheOption

WithKeyFilter creates a ClientOption that selects the Keys specified as the cache target.

func WithLogger Uses

func WithLogger(logf func(ctx context.Context, format string, args ...interface{})) CacheOption

WithLogger creates a ClientOption that uses the specified logger.

Package aememcache imports 8 packages (graph). Updated 2018-07-17. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).