diff options
author | Santiago M. Mola <santi@mola.io> | 2017-07-24 13:36:41 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-07-27 14:15:09 +0200 |
commit | f07672f5c3cad2e73596ab3d7ca16660f6881df6 (patch) | |
tree | c3e6162aacf6ee1c38bd3a3915dcb040b5006627 /plumbing/cache/common.go | |
parent | 854ffa16f650706200a6ebb5505bb448b5c64035 (diff) | |
download | go-git-f07672f5c3cad2e73596ab3d7ca16660f6881df6.tar.gz |
plumbing/cache: use more explicit interface
* renamed Add to Put
* Get returns a second bool value to indicate if there
was hit or miss.
Diffstat (limited to 'plumbing/cache/common.go')
-rw-r--r-- | plumbing/cache/common.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plumbing/cache/common.go b/plumbing/cache/common.go index 7b90c55..9efc26c 100644 --- a/plumbing/cache/common.go +++ b/plumbing/cache/common.go @@ -11,8 +11,14 @@ const ( type FileSize int64 +// Object is an interface to a object cache. type Object interface { - Add(o plumbing.EncodedObject) - Get(k plumbing.Hash) plumbing.EncodedObject + // Put puts the given object into the cache. Whether this object will + // actually be put into the cache or not is implementation specific. + Put(o plumbing.EncodedObject) + // Get gets an object from the cache given its hash. The second return value + // is true if the object was returned, and false otherwise. + Get(k plumbing.Hash) (plumbing.EncodedObject, bool) + // Clear clears every object from the cache. Clear() } |