Fixes #9. Start GC loop for in-memory textures cache.

This commit is contained in:
ErickSkrauch 2019-06-18 23:34:16 +03:00
parent e81ca1520d
commit 5b4761e4e5
3 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [Unreleased] - xxxx-xx-xx
### Fixed
- GC for in-memory textures cache has not been initialized.
## [4.2.1] - 2019-05-06
### Changed

View File

@ -25,9 +25,12 @@ type inMemoryTexturesStorage struct {
}
func CreateInMemoryTexturesStorage() *inMemoryTexturesStorage {
return &inMemoryTexturesStorage{
storage := &inMemoryTexturesStorage{
data: make(map[string]*inMemoryItem),
}
storage.Start()
return storage
}
func (s *inMemoryTexturesStorage) Start() {

View File

@ -178,8 +178,6 @@ func TestInMemoryTexturesStorage_GarbageCollection(t *testing.T) {
storage.StoreTextures("dead24f9a4fa4877b7b04c8c6c72bb46", textures1)
storage.StoreTextures("b5d58475007d4f9e9ddd1403e2497579", textures2)
storage.Start()
time.Sleep(inMemoryStorageGCPeriod + time.Millisecond) // Let it start first iteration
_, textures1Err := storage.GetTextures("dead24f9a4fa4877b7b04c8c6c72bb46")