![]() |
Online Maps
v3
|
Class for caching tiles in memory and the file system. More...
Classes | |
class | CacheAtlas |
Base class for cache atlas. More... | |
class | CacheItem |
Base class for cache item. More... | |
class | CustomCacheAtlas |
Custom cache atlas. More... | |
class | CustomCacheItem |
Custom cache item. More... | |
class | FileCacheAtlas |
File cache atlas More... | |
class | FileCacheItem |
File cache item More... | |
Public Types | |
enum | CacheLocation { CacheLocation.persistentDataPath, CacheLocation.custom } |
Location of the file cache More... | |
Public Member Functions | |
void | ClearAllCaches () |
Clear all caches. More... | |
OnlineMapsSavableItem[] | GetSavableItems () |
Returns an array of items to save More... | |
delegate bool | OnGetFromCustomCacheDelegate (string key, out byte[] bytes) |
Delegate of the event that occurs when you need to get data from the custom cache. More... | |
void | AddItem (string key, byte[] bytes=null) |
Saves data in custom cache by the key. More... | |
void | ClearCustomCache () |
Clear custom cache More... | |
int | GetCustomCacheSizeFast () |
Fast way to get the size of the file cache. More... | |
byte[] | GetItem (string key) |
Returns value from custom cache by key. More... | |
void | ClearFileCache () |
Clear file cache. More... | |
StringBuilder | GetFileCacheFolder () |
Gets the file cache folder. More... | |
int | GetFileCacheSizeFast () |
Fast way to get the size of the file cache. More... | |
StringBuilder | GetShortTilePath (OnlineMapsTile tile) |
Get the relative path to the tile in the file cache. More... | |
bool | GetTileTexture (OnlineMapsTile tile, OnlineMapsProvider.MapType mapType, out Texture2D texture) |
Gets the tile texture from file cache. More... | |
bool | TryLoadFromCache (OnlineMapsTile tile) |
Try to load tile from file cache. More... | |
void | ClearMemoryCache () |
Clear memory cache. More... | |
Static Public Member Functions | |
static void | Add (string key, byte[] bytes=null) |
Saves data in custom cache by the key. More... | |
static byte[] | Get (string key) |
Returns value from custom cache by key. More... | |
Public Attributes | |
Action< OnlineMapsTile > | OnLoadedFromCache |
Event occurs when loading the tile from the file cache or memory cache. More... | |
float | customCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the file cache (0-1). More... | |
int | maxCustomCacheSize = 100 |
The maximum size of the file cache (mb). More... | |
Action< OnlineMapsTile > | OnLoadedFromFileCache |
Event occurs when loading the tile from the file cache. More... | |
CacheLocation | fileCacheLocation = CacheLocation.persistentDataPath |
Location of the file cache. More... | |
string | fileCacheCustomPath |
Custom file cache path. More... | |
string | fileCacheTilePath = "TileCache/{pid}/{mid}/{lbs}/{lng}/{zoom}/{x}/{y}" |
Template file name in the file cache. More... | |
float | fileCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the file cache (0-1). More... | |
int | maxFileCacheSize = 100 |
The maximum size of the file cache (mb). More... | |
bool | useFileCache = true |
Flag indicating that the file cache is used. More... | |
Action< OnlineMapsTile > | OnLoadedFromMemoryCache |
Event occurs when loading the tile from the memory cache. More... | |
int | maxMemoryCacheSize = 10 |
The maximum size of the memory cache (mb). More... | |
float | memoryCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the memory cache (0-1). More... | |
bool | useMemoryCache = true |
Flag indicating that the memory cache is used. More... | |
Static Public Attributes | |
static OnGetFromCustomCacheDelegate | OnGetFromCustomCache |
Event that occurs when you need to get data from the custom cache. More... | |
Properties | |
static OnlineMapsCache | instance [get] |
The reference to an instance of the cache. More... | |
int | customCacheSize [get] |
Returns the size of the custom cache. More... | |
int | fileCacheSize [get] |
The current size of the file cache (mb). More... | |
int | memoryCacheSize [get] |
The current size of the memory cache (mb). More... | |
Class for caching tiles in memory and the file system.
|
strong |
|
static |
Saves data in custom cache by the key.
key | The unique key of the value. |
bytes | The value to be stored. |
void OnlineMapsCache.AddItem | ( | string | key, |
byte[] | bytes = null |
||
) |
Saves data in custom cache by the key.
key | The unique key of the value. |
bytes | The value to be stored. |
void OnlineMapsCache.ClearAllCaches | ( | ) |
Clear all caches.
void OnlineMapsCache.ClearCustomCache | ( | ) |
Clear custom cache
void OnlineMapsCache.ClearFileCache | ( | ) |
Clear file cache.
void OnlineMapsCache.ClearMemoryCache | ( | ) |
Clear memory cache.
|
static |
Returns value from custom cache by key.
key | The unique key of the value. |
int OnlineMapsCache.GetCustomCacheSizeFast | ( | ) |
Fast way to get the size of the file cache.
StringBuilder OnlineMapsCache.GetFileCacheFolder | ( | ) |
Gets the file cache folder.
int OnlineMapsCache.GetFileCacheSizeFast | ( | ) |
Fast way to get the size of the file cache.
byte [] OnlineMapsCache.GetItem | ( | string | key | ) |
Returns value from custom cache by key.
key | The unique key of the value. |
OnlineMapsSavableItem [] OnlineMapsCache.GetSavableItems | ( | ) |
Returns an array of items to save
Implements IOnlineMapsSavableComponent.
StringBuilder OnlineMapsCache.GetShortTilePath | ( | OnlineMapsTile | tile | ) |
Get the relative path to the tile in the file cache.
tile | Tile |
bool OnlineMapsCache.GetTileTexture | ( | OnlineMapsTile | tile, |
OnlineMapsProvider.MapType | mapType, | ||
out Texture2D | texture | ||
) |
Gets the tile texture from file cache.
tile | Tile |
mapType | Map Type |
texture | Texture |
delegate bool OnlineMapsCache.OnGetFromCustomCacheDelegate | ( | string | key, |
out byte[] | bytes | ||
) |
Delegate of the event that occurs when you need to get data from the custom cache.
bool OnlineMapsCache.TryLoadFromCache | ( | OnlineMapsTile | tile | ) |
Try to load tile from file cache.
tile | Tile |
float OnlineMapsCache.customCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the file cache (0-1).
string OnlineMapsCache.fileCacheCustomPath |
Custom file cache path.
CacheLocation OnlineMapsCache.fileCacheLocation = CacheLocation.persistentDataPath |
Location of the file cache.
string OnlineMapsCache.fileCacheTilePath = "TileCache/{pid}/{mid}/{lbs}/{lng}/{zoom}/{x}/{y}" |
Template file name in the file cache.
float OnlineMapsCache.fileCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the file cache (0-1).
int OnlineMapsCache.maxCustomCacheSize = 100 |
The maximum size of the file cache (mb).
int OnlineMapsCache.maxFileCacheSize = 100 |
The maximum size of the file cache (mb).
int OnlineMapsCache.maxMemoryCacheSize = 10 |
The maximum size of the memory cache (mb).
float OnlineMapsCache.memoryCacheUnloadRate = 0.3f |
Rate of unloaded tiles from the memory cache (0-1).
|
static |
Event that occurs when you need to get data from the custom cache.
Action<OnlineMapsTile> OnlineMapsCache.OnLoadedFromCache |
Event occurs when loading the tile from the file cache or memory cache.
Action<OnlineMapsTile> OnlineMapsCache.OnLoadedFromFileCache |
Event occurs when loading the tile from the file cache.
Action<OnlineMapsTile> OnlineMapsCache.OnLoadedFromMemoryCache |
Event occurs when loading the tile from the memory cache.
bool OnlineMapsCache.useFileCache = true |
Flag indicating that the file cache is used.
bool OnlineMapsCache.useMemoryCache = true |
Flag indicating that the memory cache is used.
|
get |
Returns the size of the custom cache.
|
get |
The current size of the file cache (mb).
|
staticget |
The reference to an instance of the cache.
|
get |
The current size of the memory cache (mb).