Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Refresh Map Layer Cache with "setExpiryTime" #73

Open
robmilton opened this issue Aug 27, 2019 · 5 comments
Open

Unable to Refresh Map Layer Cache with "setExpiryTime" #73

robmilton opened this issue Aug 27, 2019 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@robmilton
Copy link

robmilton commented Aug 27, 2019

Description

The method "setExpiryTime" in the Layer class has the following description:
/**
* Specifies the time of the layer's most recent dataset update. If greater than zero, the layer ignores and
* eliminates any previously cached data older than the time specified, and requests new information from the data
* source. If zero, the layer uses any expiry times intrinsic to the layer, typically initialized at layer
* construction. The default expiry time is 0, thereby enabling a layer's intrinsic expiration criteria.
*
* @param expiryTime the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch.
*
* @see System#currentTimeMillis() for a description of milliseconds beyond the epoch.
*/

And reading through the WorldWind Java Forum there are several posts claiming that using "setExpiryTime(System.currentTimeMillis())" will invalidate a layer's tile cache both in memory and on disc causing new tiles to be retrieved from the source.

However, when I use this method as described nothing seems to happen. Even though the "setExpiryTime" seemed to execute without issue the return value for "tile.getLevel().getExpiryTime()" is the default value of 0 (zero).

Expected behavior:
The documentation says that setting "setExpiryTime(System.currentTimeMillis())" should invalidate the tiles for the specified layer both in memory and on disc and force new tiles to be retrieved from their source.

Actual behavior:
The cached tiles are used instead of fetching the tiles from the source.

Steps to Reproduce

  1. Call layer.setExpiryTime(System.currentTimeMillis()); for the desired map layer

Reproduces how often:
Always

Operating System and Version

Windows 10 version 1903

Additional Information

Maybe I'm missing something. Are there other flags that need to be set or other calls that need to be made to mark a layer's current cache as expired and force tiles to be downloaded from their source?

Edit
Per Patrick's request I've submitted this issue at the NASA WWJ repo:
NASAWorldWind#174

@PJHogan
Copy link
Member

PJHogan commented Aug 27, 2019

Oooh! I like this one! Good stuff!

@robmilton
Copy link
Author

I decided to take another approach to the problem I was trying to resolve: providing a method for a client to delete local tile cache for a selected map.

But the issue described above still exists, and I would consider it to be a "bug" (at least based on the documentation).

However, I wonder if the "setExpiryTime" method only works if a layer's XML config file contains a "LastUpdate" node? Our layers do not contain this node. I suppose it might be possible that the "setExpiryTime" method requires the existence of this node.

I'm pretty swamped at the moment, but I hope to be able to test this before too long.

@PJHogan
Copy link
Member

PJHogan commented Aug 28, 2019

[I hear from others]
This is not straightforward, to coerce a WorldWind image layer to refresh itself. And I say “coerce” quite intentionally as WorldWind’s image layer was originally designed around the use case of viewing imagery that never changes.
Would be a big help if you would raise this issue at the NASA repo, so that team might provide some guidance. And you could always bring it back wherever needed.
https://github.com/NASAWorldWind/WorldWindJava

@wcmatthysen
Copy link
Member

@robmilton, maybe this can be tackled in a 2.3.0 release.

@wcmatthysen wcmatthysen added the bug Something isn't working label Sep 2, 2019
@wcmatthysen
Copy link
Member

@PJHogan, I saw the recent notice on the WorldWind site. Are the upstream guys going to start development again? Do you have any info on how this might affect us here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants