Giter Site home page Giter Site logo

ztcache's Introduction

ztcache

Go implementation of "zero time cache pattern"

import "github.com/hnw/ztcache"

Package ztcache は zero time cache pattern の実装です。 同じ結果を返す処理が並行に呼び出された場合に、1回の処理にまとめて相乗りさせるような仕組みを提供します。

Usage

type ZTCache

type ZTCache struct {
}

ZTCache は動作中の処理を管理する構造体です。

func New

func New() *ZTCache

New は ZTCache構造体のコンストラクタです。

func (*ZTCache) Get

func (c *ZTCache) Get(key string, f func() string) (interface{}, error)

Get は処理結果を取得するためのラッパー関数です。 同じkeyで同時に呼び出された処理がある場合に並行に走らせず、前の処理の終了を待った上で必要なら相乗りして実行結果を複数呼び出し間で共有します。

ztcache's People

Contributors

hnw avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.