datacache

package
v0.0.0-...-685a0e9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

datacache wraps database. It utilizes appengine/memcache to reduce the workload in database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(title string, ctx appengine.Context) error

Delete wraps database.Delete. Like Put, this function is lazy to snapshot. return the same value as database.Delete Blog owner need to flush the whole memcache if he or she need the corresponding snapshot be deleted immediately.

func Get

func Get(key string, ctx appengine.Context) (*post.Post, error)

Get wraps database.Get. It return the same value as database.Get(). Plus a record a log if memcache errors occur If item exists in cache, return. Otherwise, retrieve from db and stores in cache.

func Put

func Put(data *post.Post, isUpdate bool, ctx appengine.Context) error

Put wraps database.Put and return the value from database.Put. If update change the snapshot of that item and it is really important to update that snapshot immediately, user should use a special link to flush the entire memcache. Nonetheless, new snapshot should be updated within 1 week

func Query

func Query(offset, limit int, ctx appengine.Context) ([]post.Post, bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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