Interface StorageManager

com.yandex.mapkit.storage

public interface StorageManager

Storage manager.

This is a manager that controls temporary cache storages (e.g. map tiles).

Nested Classes

Methods

void addStorageErrorListener(@NonNull StorageErrorListener errorListener)

Subscribes to storage events.

void clear(@NonNull ClearListener callback)

Removes all data.

void computeSize(@NonNull SizeListener callback)

Computes storage size in bytes.

boolean isValid()

Tells if this StorageManager is valid or no.

void maxTileStorageSize(@NonNull SizeListener callback)

Obtains the current storage size limit in bytes.

void moveData(@NonNull String newPath, @NonNull StorageMoveListener storageMoveListener)

Moves storage to the specified folder.

void removeStorageErrorListener(@NonNull StorageErrorListener errorListener)

Unsubscribes from storage events.

void requestPath(@NonNull PathGetterListener callback)

Provides the data path for storage files.

void resetMaxTileStorageSize()

Resets the tile cache size limit.

void setMaxTileStorageSize(long limit)

Sets the maximum tile cache size to limit bytes.

Method Detail

addStorageErrorListener

public void addStorageErrorListener (@NonNull StorageErrorListener errorListener)

Subscribes to storage events.

clear

public void clear (@NonNull ClearListener callback)

Removes all data.

computeSize

public void computeSize (@NonNull SizeListener callback)

Computes storage size in bytes.

isValid

public boolean isValid ()

Tells if this StorageManager is valid or no.

Any other method (except for this one) called on an invalid StorageManager will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.

maxTileStorageSize

public void maxTileStorageSize (@NonNull SizeListener callback)

Obtains the current storage size limit in bytes.

moveData

public void moveData (@NonNull String newPath, @NonNull StorageMoveListener storageMoveListener)

Moves storage to the specified folder.

This operation is non-cancellable. If there is already a pending operation to set the storage path, it throws an error (Android). If the application exits before the operation is completed, it does not take effect, but garbage will not be cleared.
Parameters:
newPath

New path to store data.

storageMoveListener

It will be unsubscribed automatically when the operation is completed or fails with an error.

removeStorageErrorListener

public void removeStorageErrorListener (@NonNull StorageErrorListener errorListener)

Unsubscribes from storage events.

requestPath

public void requestPath (@NonNull PathGetterListener callback)

Provides the data path for storage files.

resetMaxTileStorageSize

public void resetMaxTileStorageSize ()

Resets the tile cache size limit.

setMaxTileStorageSize

public void setMaxTileStorageSize (long limit)

Sets the maximum tile cache size to limit bytes.

When the limit is reached, old tiles are removed.