Agora RTC Objective-C API Reference Refactor

Instance Methods | Class Methods
<AgoraRtcMediaPlayerCacheManagerProtocol> Protocol Reference

Inherits <NSObject>.

## Instance Methods
(int) | - removeAllCaches
(int) | - removeOldCache
(int) | - removeCacheByUri:
(int) | - setCacheDir:
(int) | - setMaxCacheFileCount:
(int) | - setMaxCacheFileSize:
(int) | - enableAutoRemoveCache:
(NSString *) | - cacheDir
(NSInteger) | - maxCacheFileCount
(NSInteger) | - maxCacheFileSize
(NSInteger) | - cacheFileCount

## Class Methods
(instancetype) | + sharedInstance

## Method Documentation

## ◆ sharedInstance

+ (instancetype) sharedInstance |  |  |

Get shared cacheManager instance.

Returns
  cacheManager instance.

## ◆ removeAllCaches

- (int) removeAllCaches |  |  |

Remove all media resource cache files.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ removeOldCache

- (int) removeOldCache |  |  |

Remove the latest media resource cache file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ removeCacheByUri:

- (int) removeCacheByUri: |  | (NSString *) | uri |

Remove the cache file by uri, setting by MediaSource.

Parameters

  uri | URI，identify the uniqueness of the property, Set from `MeidaSource`

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setCacheDir:

- (int) setCacheDir: |  | (NSString *) | cacheDir |

Set cache file path that files will be saved to.

Parameters

  cacheDir | cacheDir path.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setMaxCacheFileCount:

- (int) setMaxCacheFileCount: |  | (NSInteger) | count |

Set the maximum number of cached files.

Parameters

  count | maximum number of cached files.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setMaxCacheFileSize:

- (int) setMaxCacheFileSize: |  | (NSInteger) | cacheSize |

Set the total size of the largest cache file.

Parameters

  cacheSize | total size of the largest cache file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ enableAutoRemoveCache:

- (int) enableAutoRemoveCache: |  | (BOOL) | enable |

Set whether the player will clean up the cache in the order of resource usage.

Parameters

  enable | enable the player to automatically clear the cache.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ cacheDir

- (NSString *) cacheDir |  |  |

Get the cache directory you have set.

Returns
  cacheDir

## ◆ maxCacheFileCount

- (NSInteger) maxCacheFileCount |  |  |

Get the maximum number of cached files.

Returns

  > 0: file count.

  - < 0: Failure.

## ◆ maxCacheFileSize

- (NSInteger) maxCacheFileSize |  |  |

Get the total size of the largest cache file

Returns

  > 0: file size.

  - < 0: Failure.

## ◆ cacheFileCount

- (NSInteger) cacheFileCount |  |  |

Get the number of all cache files.

Returns

  > 0: file count.

  - < 0: Failure.