TileCache¶
Namespace: ThinkGeo.Core
This is the base class for TileCache system.
public abstract class TileCache
Inheritance object → TileCache
Remarks:
TileCache system is very efficient in improving the performance of application, especially when large data or remote server images are included.
Properties¶
TileAccessMode¶
Gets or sets the Mode for the TileCache access the tiles. The Default value is ReadAddDelete
public TileAccessMode TileAccessMode { get; set; }
Property Value¶
Remarks:
If you want it to take effect, you need set the Read property false.
CacheId¶
Gets or sets the id of the TileCache.
public string CacheId { get; set; }
Property Value¶
ExpirationTime¶
Gets or sets the ExpirationTime.
public TimeSpan ExpirationTime { get; set; }
Property Value¶
Methods¶
GetLastUpdatedTimeUtcAsync(CancellationToken)¶
Gets the UTC time when any tile in this cache was most recently saved.
public Task<Nullable<DateTime>> GetLastUpdatedTimeUtcAsync(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that can be used to cancel the operation.
Returns¶
A task that returns the most recent tile save time in UTC, or null when the cache is empty
or the last update time cannot be determined.
OnGottenTile(GottenTileTileCacheEventArgs)¶
Performs on gotten tile.
protected void OnGottenTile(GottenTileTileCacheEventArgs e)
Parameters¶
e GottenTileTileCacheEventArgs
The e.
Returns¶
OnGettingTile(GettingTileTileCacheEventArgs)¶
Performs on getting tile.
protected void OnGettingTile(GettingTileTileCacheEventArgs e)
Parameters¶
e GettingTileTileCacheEventArgs
The e.
Returns¶
GetTile(int, long, long)¶
This method returns the BitmapTile corresponding to passed in row and column.
public Tile GetTile(int zoom, long x, long y)
Parameters¶
zoom int
Specifies the zoom.
x long
The target column for the tileView to fetch.
y long
The target row for the tileView to fetch.
Returns¶
Tile
Returns the BitmapTile corresponding to the passed in row and column.
GetTileAsync(int, long, long, CancellationToken)¶
This method returns the BitmapTile corresponding to passed in row and column.
public Task<Tile> GetTileAsync(int zoom, long x, long y, CancellationToken cancellationToken)
Parameters¶
zoom int
Specifies the zoom.
x long
Specifies the x.
y long
Specifies the y.
cancellationToken CancellationToken
Specifies the cancellationToken.
Returns¶
Task<Tile>
Returns the BitmapTile corresponding to the passed in row and column.
OnSavingTile(SavingTileTileCacheEventArgs)¶
Performs on saving tile.
protected void OnSavingTile(SavingTileTileCacheEventArgs e)
Parameters¶
e SavingTileTileCacheEventArgs
The e.
Returns¶
OnSavedTile(SavedTileTileCacheEventArgs)¶
Performs on saved tile.
protected void OnSavedTile(SavedTileTileCacheEventArgs e)
Parameters¶
e SavedTileTileCacheEventArgs
The e.
Returns¶
SaveTile(Tile)¶
This method will save the target tileView passed in.
public void SaveTile(Tile tile)
Parameters¶
tile Tile
The target tileView to be saved.
Returns¶
Exceptions¶
ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.
SaveTileAsync(Tile, CancellationToken)¶
Saves the current object to the specified destination.
public Task SaveTileAsync(Tile tile, CancellationToken cancellationToken)
Parameters¶
tile Tile
The tile.
cancellationToken CancellationToken
A cancellation or authentication token, depending on context.
Returns¶
Task
A task that represents the asynchronous operation.
DrainAsync(CancellationToken)¶
Turns new writes away and waits for the ones in flight to finish, so the cache's storage can be retired - a directory removed or rotated, a database closed - with no writer still in it. Reads go on. While the returned handle is held, a tile handed to TileCache.SaveTile(Tile) or TileCache.DeleteTile(Tile) is not written: drawing continues, the cache simply skips it. Dispose the handle to accept writes again. An application used to gate its own drawing to get this; the cache knows its writers. https://community.thinkgeo.com/t/v15-beta160-follow-up-remaining-gpu-style-parity-source-lifecycle-wfs-v2-and-wms-gaps/12468
public Task<IDisposable> DrainAsync(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
Cancels the wait; writes stay paused until the cancelled call's handle would have been disposed, so a cancelled drain resumes writes itself.
Returns¶
Task<IDisposable>
A handle; disposing it accepts writes again.
DeleteTile(Tile)¶
This method will delete the target tileView passed in.
public void DeleteTile(Tile tile)
Parameters¶
tile Tile
The target tileView to be deleted.
Returns¶
Exceptions¶
ArgumentNullException
If you pass a null as the target tileView, we will throw an ArgumentNullException.
ClearCache()¶
This method will clear all the tiles in the tileCache.
public void ClearCache()
Returns¶
GetLastUpdatedTimeUtcAsyncCore(CancellationToken)¶
Provides the overridable implementation that gets the UTC time when any tile in this cache was most recently saved.
protected Task<Nullable<DateTime>> GetLastUpdatedTimeUtcAsyncCore(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that can be used to cancel the operation.
Returns¶
A task that returns the most recent tile save time in UTC, or null when the cache is empty
or the last update time cannot be determined.
ClearCacheCore()¶
This abstract method will clear all the tiles in the tileCache, for each sub TileCache class must implement this method.
protected abstract void ClearCacheCore()
Returns¶
SaveTileCore(Tile)¶
This abstract method will save the target tileView passed in, for each sub TileCache class must implement this method.
protected void SaveTileCore(Tile tile)
Parameters¶
tile Tile
The target tileView to be saved.
Returns¶
DeleteTileCore(Tile)¶
This abstract method will delete the target tileView passed in, for each sub TileCache class must implement this method.
protected abstract void DeleteTileCore(Tile tile)
Parameters¶
tile Tile
The target tileView to be deleted.
Returns¶
SaveTileAsyncCore(Tile, CancellationToken)¶
Provides the overridable implementation that saves the current object to the specified destination.
protected Task SaveTileAsyncCore(Tile tile, CancellationToken cancellationToken)
Parameters¶
tile Tile
The tile.
cancellationToken CancellationToken
A cancellation or authentication token, depending on context.
Returns¶
Task
A task that represents the asynchronous operation.
GetTileAsyncCore(int, long, long, CancellationToken)¶
Provides the overridable implementation that returns tile async for the specified parameters.
protected Task<Tile> GetTileAsyncCore(int zoom, long x, long y, CancellationToken cancellationToken)
Parameters¶
zoom int
The zoom.
x long
The x-coordinate, in pixels.
y long
The y-coordinate, in pixels.
cancellationToken CancellationToken
A cancellation or authentication token, depending on context.
Returns¶
Task<Tile>
A task that represents the asynchronous operation and provides the result.
GetTileCore(int, long, long)¶
This abstract method returns the BitmapTile corresponding to passed in row and column. Each concrete TileCache need to implement this logic to get tileView from a row and column.
protected Tile GetTileCore(int zoom, long x, long y)
Parameters¶
zoom int
x long
The target column for the tileView to fetch.
y long
The target row for the tileView to fetch.
Returns¶
Tile
Returns the BitmapTile corresponding to the passed in row and column.
Events¶
GottenTile¶
Occurs when the GottenTile event is raised.
public event EventHandler<GottenTileTileCacheEventArgs> GottenTile;
GettingTile¶
Occurs when the GettingTile event is raised.
public event EventHandler<GettingTileTileCacheEventArgs> GettingTile;
SavingTile¶
Occurs when the SavingTile event is raised.
public event EventHandler<SavingTileTileCacheEventArgs> SavingTile;
SavedTile¶
Occurs when the SavedTile event is raised.
public event EventHandler<SavedTileTileCacheEventArgs> SavedTile;