Skip to content

Add new cacheSize option to ol.source #4805

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

Merged
merged 2 commits into from
Mar 1, 2016
Merged

Conversation

fredj
Copy link
Member

@fredj fredj commented Feb 8, 2016

Fixes #4702

Option added to:

  • olx.source.BingMapsOptions
  • olx.source.MapQuestOptions
  • olx.source.OSMOptions
  • olx.source.StamenOptions
  • olx.source.TileArcGISRestOptions
  • olx.source.TileImageOptions
  • olx.source.TileJSONOptions
  • olx.source.TileWMSOptions
  • olx.source.XYZOptions
  • olx.source.ZoomifyOptions

All sources except vector, static image and single image

@fredj fredj force-pushed the cacheSize branch 2 times, most recently from be48e37 to 6877468 Compare February 8, 2016 14:34
@ahocevar
Copy link
Member

ahocevar commented Feb 8, 2016

I'm wondering if the tile cache should be per-map instead of per-source. Opinions?

@lol2x
Copy link

lol2x commented Feb 29, 2016

Is there any plan to merge it to dist version? Actually usage of RAM in firefox is unaceptable (especially on older PC's) or there is any "newer" way to solve caching size (without rebuilding whole ol)

@ahocevar
Copy link
Member

After doing bit more research, I think it is reasonable to continue with the approach you proposed here @fredj.

An improvement for another pull request would be to completely disable the tile cache for sources that are known to send sensible cache headers, because the browser cache properly handles them. I did some testing with OSM, and I didn't notice any visual performance penalties with a disabled tile cache.

@fredj
Copy link
Member Author

fredj commented Feb 29, 2016

ok, I will finish this PR

@fredj fredj force-pushed the cacheSize branch 4 times, most recently from b220114 to dd960b6 Compare February 29, 2016 12:33
@fredj fredj changed the title [wip] Add new cacheSize option to ol.source Add new cacheSize option to ol.source Feb 29, 2016
@fredj
Copy link
Member Author

fredj commented Feb 29, 2016

thanks for any review

@lol2x
Copy link

lol2x commented Feb 29, 2016

@fredj Is it added to ol.source.WMTS as well? Thanks for that commit, will make my work easier

@fredj
Copy link
Member Author

fredj commented Feb 29, 2016

Yes, it has been added to ol.source.WMTS

@ahocevar
Copy link
Member

Thanks @fredj. Two minor comments:

  • The docs are not 100% correct (default is the value of ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK, which has a default of 2048). Maybe you can change that?
  • There is also ol.source.VectorTile which has a tile cache, but with a smaller default size. Maybe you want to make that configurable as well?

Both comments can also be addressed in separate pull requests, but if you're still at it, you might want to address them here.

It's up to you to merge now or after making these changes 😄.

@fredj
Copy link
Member Author

fredj commented Feb 29, 2016

The docs are not 100% correct (default is the value of ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK, which has a default of 2048). Maybe you can change that?

It's already 2048 in externs/olx.js or do I miss something ?

There is also ol.source.VectorTile which has a tile cache, but with a smaller default size. Maybe you want to make that configurable as well?

Yes, I will add the option to ol.source.VectorTile

@ahocevar
Copy link
Member

It's already 2048 in externs/olx.js or do I miss something?

I was just wondering if ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK should be mentioned, because it can be changed as a compiler define.

@fredj
Copy link
Member Author

fredj commented Feb 29, 2016

I was just wondering if ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK should be mentioned, because it can be changed as a compiler define.

ok, got it.

Now that we have a simple way to change this value what about removing ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK ?

@ahocevar
Copy link
Member

Now that we have a simple way to change this value what about removing ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK ?

👍 - with an upgrade note.

fredj added 2 commits March 1, 2016 09:05
Option added to:
 - olx.source.BingMapsOptions
 - olx.source.MapQuestOptions
 - olx.source.OSMOptions
 - olx.source.StamenOptions
 - olx.source.TileArcGISRestOptions
 - olx.source.TileImageOptions
 - olx.source.TileJSONOptions
 - olx.source.TileWMSOptions
 - olx.source.VectorTileOptions
 - olx.source.XYZOptions
 - olx.source.WMTSOptions
 - olx.source.ZoomifyOptions
fredj added a commit that referenced this pull request Mar 1, 2016
Add new cacheSize option to ol.source
@fredj fredj merged commit fbbbcf5 into openlayers:master Mar 1, 2016
@fredj fredj deleted the cacheSize branch March 1, 2016 09:46
@ahocevar
Copy link
Member

ahocevar commented Mar 1, 2016

Great work, thanks @fredj.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants