aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/cache/common.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-08-17 08:46:19 +0200
committerGitHub <noreply@github.com>2018-08-17 08:46:19 +0200
commitba0f659cbf9982846de731cca426ce2498601130 (patch)
treed4816a29f6460de9d481861cb36c4248212c6270 /plumbing/cache/common.go
parenta28c2ce44695f13ddf28748958f236afd8e0b544 (diff)
parenteb2aa9b2c3bf7af93fd261228be1b96e61c52bcf (diff)
downloadgo-git-ba0f659cbf9982846de731cca426ce2498601130.tar.gz
Merge pull request #916 from jfontan/improvement/memory-consumption-new-packfile-parser
Improvement/memory consumption new packfile parser
Diffstat (limited to 'plumbing/cache/common.go')
-rw-r--r--plumbing/cache/common.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/plumbing/cache/common.go b/plumbing/cache/common.go
index e77baf0..2b7f36a 100644
--- a/plumbing/cache/common.go
+++ b/plumbing/cache/common.go
@@ -24,3 +24,16 @@ type Object interface {
// Clear clears every object from the cache.
Clear()
}
+
+// Buffer is an interface to a buffer cache.
+type Buffer interface {
+ // Put puts a buffer into the cache. If the buffer is already in the cache,
+ // it will be marked as used. Otherwise, it will be inserted. Buffer might
+ // be evicted to make room for the new one.
+ Put(key int64, slice []byte)
+ // Get returns a buffer by its key. It marks the buffer as used. If the
+ // buffer is not in the cache, (nil, false) will be returned.
+ Get(key int64) ([]byte, bool)
+ // Clear clears every object from the cache.
+ Clear()
+}