Closed hwiesmann closed 9 years ago
Please clarify: you say that "maxAge" is being ignored, but also that isExpired() leads to new data being loaded. These cannot both be true. isExpired() only loads new data if the cache entry is older than maxAge. In any case none of this has anything to do with the overall size of the cache. You are assuming that expired entries should be deleted, but that is not the case.
I indeed expected that expired entries would be deleted because what do you want to do with these items?
When a cache entry gets expired that just means that osgEarth will go back to the server to check to see if newer data is available instead of using the cached data. This allows you to upload new tiles to a server and osgEarth will actually pull them down automatically instead of forcing you to delete your cache manually.
Jason
On Wed, Feb 25, 2015 at 4:14 PM hwiesmann notifications@github.com wrote:
I indeed expected that expired entries would be deleted because what do you want to do with these items?
— Reply to this email directly or view it on GitHub https://github.com/gwaldron/osgearth/issues/592#issuecomment-76060575.
To add to that: A "maxAge" does not mean the tile is no longer good. It just means it's time to check for a newer one. If the server doesn't have a newer tile, it will response with an HTTP 503, which means "you have the latest version already". In that case the cache marks the file as up-to-date and uses it.
Although you can set a max age for a file system cache it is ignored (file system cache is continuously growing):
1) In image and elevation layers isExpired is tested but this leads only to loading new data instead of using the cached data. 2) The method Cache::removeBin is only called in a destructor of TerrainLayer but this seems to remove only the internally used cache but non of the files in the file system cache. At least non of the removal methods of file system cache is called. 3) The method FileSystemCacheBin::remove is only declared and defined but nowhere used.
Therefore, from the source code I cannot find any hint that the file system cache can shrink.