FWPlayerCacheManager

@interface FWPlayerCacheManager : NSObject

+ (void)setCacheDirectory:(NSString *)cacheDirectory;
+ (NSString *)cacheDirectory;


/**
 How often trigger `FWPlayerCacheManagerDidUpdateCacheNotification` notification

 @param interval Minimum interval
 */
+ (void)setCacheUpdateNotifyInterval:(NSTimeInterval)interval;
+ (NSTimeInterval)cacheUpdateNotifyInterval;

+ (NSString *)cachedFilePathForURL:(NSURL *)url;
+ (FWPlayerCacheConfiguration *)cacheConfigurationForURL:(NSURL *)url;

+ (void)setFileNameRules:(NSString *(^)(NSURL *url))rules;


/**
 Calculate cached files size

 @param error If error not empty, calculate failed
 @return files size, respresent by `byte`, if error occurs, return -1
 */
+ (unsigned long long)calculateCachedSizeWithError:(NSError **)error;
+ (void)cleanAllCacheWithError:(NSError **)error;
+ (void)cleanCacheForURL:(NSURL *)url error:(NSError **)error;


/**
 Useful when you upload a local file to the server

 @param filePath local file path
 @param url remote resource url
 @param error On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information.
 */
+ (BOOL)addCacheFile:(NSString *)filePath forURL:(NSURL *)url error:(NSError **)error;

@end

Undocumented

  • Undocumented

    Declaration

    Objective-C

    + (void)setCacheDirectory:(NSString *)cacheDirectory;
  • Undocumented

    Declaration

    Objective-C

    + (NSString *)cacheDirectory;
  • How often trigger FWPlayerCacheManagerDidUpdateCacheNotification notification

    Declaration

    Objective-C

    + (void)setCacheUpdateNotifyInterval:(NSTimeInterval)interval;

    Parameters

    interval

    Minimum interval

  • Undocumented

    Declaration

    Objective-C

    + (NSTimeInterval)cacheUpdateNotifyInterval;
  • Undocumented

    Declaration

    Objective-C

    + (NSString *)cachedFilePathForURL:(NSURL *)url;
  • Undocumented

    Declaration

    Objective-C

    + (FWPlayerCacheConfiguration *)cacheConfigurationForURL:(NSURL *)url;
  • Undocumented

    Declaration

    Objective-C

    + (void)setFileNameRules:(NSString *(^)(NSURL *url))rules;
  • Calculate cached files size

    Declaration

    Objective-C

    + (unsigned long long)calculateCachedSizeWithError:
        (NSError *__autoreleasing _Nullable *_Nullable)error;

    Parameters

    error

    If error not empty, calculate failed

    Return Value

    files size, respresent by byte, if error occurs, return -1

  • Undocumented

    Declaration

    Objective-C

    + (void)cleanAllCacheWithError:(NSError **)error;
  • Undocumented

    Declaration

    Objective-C

    + (void)cleanCacheForURL:(NSURL *)url error:(NSError **)error;
  • Useful when you upload a local file to the server

    Declaration

    Objective-C

    + (BOOL)addCacheFile:(nonnull NSString *)filePath
                  forURL:(nonnull NSURL *)url
                   error:(NSError *__autoreleasing _Nullable *_Nullable)error;

    Parameters

    filePath

    local file path

    url

    remote resource url

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information.