aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/cache
Commit message (Collapse)AuthorAgeFilesLines
* plumbing/cache: check for empty cache listJavi Fontan2019-02-252-1/+19
| | | | | | | | If there is wrong data in the cache it may cause the eviction code to empty the object list and cause a panic. This patch adds a check and sets the cache usage to 0 when this happens. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Remove empty space to trigger windows build.kuba--2018-09-172-4/+0
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Fix potential LRU cache size issue.kuba--2018-09-174-22/+68
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* plumbing: add buffer cache and use it in packfile parserJavi Fontan2018-08-143-0/+239
| | | | | | | It uses less memory and is faster as slices don't have to be converted from/to MemoryObject and they are indexed by offset. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* all: remove some unused codeDaniel Martí2018-03-011-46/+0
| | | | Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
* Test eviction of more than one objectJavi Fontan2018-01-161-0/+20
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Cache should hold objects the same size as MaxSizeJavi Fontan2018-01-161-1/+1
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Modify cache to delete more than one item to free spaceJavi Fontan2018-01-161-5/+1
| | | | | | | | | | | The previous version could only delete the oldest used object. If the object to cache was bigger than the space freed it could not be added. Also the decoder adds bases to the cache when they are needed. This change increases the speed creating indexes 2x. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Exercise NewObjectLRUDefault in testingJavi Fontan2017-12-201-41/+60
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Enforce the use of cache in packfile decoderJavi Fontan2017-12-202-0/+7
| | | | | | | | | | | | | | | | | Decoder object can make use of an object cache to speed up processing. Previously the only way to specify it was changing manually the struct generated by NewDecodeForFile. This lead to some instances to be created without it and penalized performance. Now the cache should be explicitly passed to the constructor function. NewDecoder now creates objects with a cache using the default size. A new helper function was added to create cache objects with the default size as this becomes a common task now: cache.NewObjectLRUDefault() Signed-off-by: Javi Fontan <jfontan@gmail.com>
* fix race condition on ObjectLRUMiguel Molina2017-08-112-0/+39
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* plumbing/cache: change FIFO to LRU cacheSantiago M. Mola2017-07-273-90/+93
|
* plumbing/cache: use more explicit interfaceSantiago M. Mola2017-07-273-19/+38
| | | | | | * renamed Add to Put * Get returns a second bool value to indicate if there was hit or miss.
* project: move imports from srcd.works to gopkg.inAntonio Jesus Navarro Perez2017-03-074-4/+4
| | | | To be able to fix #261 we will move again to gopkg.in before v4 stable release.
* plumbing/cache: specify units in memory size (Fix #234)Antonio Jesus Navarro Perez2017-02-273-16/+21
|
* cache: move package to plumbingAntonio Jesus Navarro Perez2017-02-214-0/+215
Because cache package is only intended to be used at internal level, we move it to the plumbing package.