Class NSURLCache

  • All Implemented Interfaces:
    NSObject

    public class NSURLCache
    extends NSObject
    API-Since: 2.0
    • Constructor Detail

      • NSURLCache

        protected NSURLCache​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static NSURLCache allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setSharedURLCache

        public static void setSharedURLCache​(@NotNull
                                             @NotNull NSURLCache value)
        [@property] sharedURLCache Returns the shared NSURLCache instance or sets the NSURLCache instance shared by all clients of the current process. This will be the new object returned when calls to the sharedURLCache method are made. Unless set explicitly through a call to +setSharedURLCache:, this method returns an NSURLCache instance created with the following default values:
        • Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes)
        • Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes)
        • Disk path: (user home directory)/Library/Caches/(application bundle id)

        Users who do not have special caching requirements or constraints should find the default shared cache instance acceptable. If this default shared cache instance is not acceptable, +setSharedURLCache: can be called to set a different NSURLCache instance to be returned from this method. Callers should take care to ensure that the setter is called at a time when no other caller has a reference to the previously-set shared URL cache. This is to prevent storing cache data from becoming unexpectedly unretrievable.

      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • sharedURLCache

        @NotNull
        public static @NotNull NSURLCache sharedURLCache()
        [@property] sharedURLCache Returns the shared NSURLCache instance or sets the NSURLCache instance shared by all clients of the current process. This will be the new object returned when calls to the sharedURLCache method are made. Unless set explicitly through a call to +setSharedURLCache:, this method returns an NSURLCache instance created with the following default values:
        • Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes)
        • Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes)
        • Disk path: (user home directory)/Library/Caches/(application bundle id)

        Users who do not have special caching requirements or constraints should find the default shared cache instance acceptable. If this default shared cache instance is not acceptable, +setSharedURLCache: can be called to set a different NSURLCache instance to be returned from this method. Callers should take care to ensure that the setter is called at a time when no other caller has a reference to the previously-set shared URL cache. This is to prevent storing cache data from becoming unexpectedly unretrievable.

        Returns:
        the shared NSURLCache instance.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • cachedResponseForRequest

        @Nullable
        public @Nullable NSCachedURLResponse cachedResponseForRequest​(@NotNull
                                                                      @NotNull NSURLRequest request)
        cachedResponseForRequest: Returns the NSCachedURLResponse stored in the cache with the given request. The method returns nil if there is no NSCachedURLResponse stored using the given request.
        Parameters:
        request - the NSURLRequest to use as a key for the lookup.
        Returns:
        The NSCachedURLResponse stored in the cache with the given request, or nil if there is no NSCachedURLResponse stored with the given request.
      • currentDiskUsage

        public long currentDiskUsage()
        Returns the current amount of space consumed by the on-disk cache of the receiver. This size, measured in bytes, indicates the current usage of the on-disk cache.
        Returns:
        the current usage of the on-disk cache of the receiver.
      • currentMemoryUsage

        public long currentMemoryUsage()
        Returns the current amount of space consumed by the in-memory cache of the receiver. This size, measured in bytes, indicates the current usage of the in-memory cache.
        Returns:
        the current usage of the in-memory cache of the receiver.
      • diskCapacity

        public long diskCapacity()
        The on-disk capacity of the receiver. The on-disk capacity, measured in bytes, for the receiver. On mutation the on-disk cache will truncate its contents to the size given, if necessary.
      • initWithMemoryCapacityDiskCapacityDiskPath

        @Deprecated
        public NSURLCache initWithMemoryCapacityDiskCapacityDiskPath​(long memoryCapacity,
                                                                     long diskCapacity,
                                                                     @Nullable
                                                                     @Nullable java.lang.String path)
        Deprecated.
        initWithMemoryCapacity:diskCapacity:diskPath: Initializes an NSURLCache with the given capacity and path. The returned NSURLCache is backed by disk, so developers can be more liberal with space when choosing the capacity for this kind of cache. A disk cache measured in the tens of megabytes should be acceptable in most cases.
        Parameters:
        memoryCapacity - the capacity, measured in bytes, for the cache in memory.
        diskCapacity - the capacity, measured in bytes, for the cache on disk.
        path - the path on disk where the cache data is stored.
        Returns:
        an initialized NSURLCache, with the given capacity, backed by disk. API-Since: 2.0 Deprecated-Since: 100000.0
      • memoryCapacity

        public long memoryCapacity()
        In-memory capacity of the receiver. At the time this call is made, the in-memory cache will truncate its contents to the size given, if necessary.
        Returns:
        The in-memory capacity, measured in bytes, for the receiver.
      • removeAllCachedResponses

        public void removeAllCachedResponses()
        removeAllCachedResponses Clears the given cache, removing all NSCachedURLResponse objects that it stores.
      • removeCachedResponseForDataTask

        public void removeCachedResponseForDataTask​(@NotNull
                                                    @NotNull NSURLSessionDataTask dataTask)
        API-Since: 8.0
      • removeCachedResponseForRequest

        public void removeCachedResponseForRequest​(@NotNull
                                                   @NotNull NSURLRequest request)
        removeCachedResponseForRequest: Removes the NSCachedURLResponse from the cache that is stored using the given request. No action is taken if there is no NSCachedURLResponse stored with the given request.
        Parameters:
        request - the NSURLRequest to use as a key for the lookup.
      • removeCachedResponsesSinceDate

        public void removeCachedResponsesSinceDate​(@NotNull
                                                   @NotNull NSDate date)
        removeCachedResponsesSince: Clears the given cache of any cached responses since the provided date. API-Since: 8.0
      • setDiskCapacity

        public void setDiskCapacity​(long value)
        The on-disk capacity of the receiver. The on-disk capacity, measured in bytes, for the receiver. On mutation the on-disk cache will truncate its contents to the size given, if necessary.
      • setMemoryCapacity

        public void setMemoryCapacity​(long value)
        In-memory capacity of the receiver. At the time this call is made, the in-memory cache will truncate its contents to the size given, if necessary.
      • storeCachedResponseForDataTask

        public void storeCachedResponseForDataTask​(@NotNull
                                                   @NotNull NSCachedURLResponse cachedResponse,
                                                   @NotNull
                                                   @NotNull NSURLSessionDataTask dataTask)
        API-Since: 8.0
      • storeCachedResponseForRequest

        public void storeCachedResponseForRequest​(@NotNull
                                                  @NotNull NSCachedURLResponse cachedResponse,
                                                  @NotNull
                                                  @NotNull NSURLRequest request)
        storeCachedResponse:forRequest: Stores the given NSCachedURLResponse in the cache using the given request.
        Parameters:
        cachedResponse - The cached response to store.
        request - the NSURLRequest to use as a key for the storage.
      • initWithMemoryCapacityDiskCapacityDirectoryURL

        public NSURLCache initWithMemoryCapacityDiskCapacityDirectoryURL​(long memoryCapacity,
                                                                         long diskCapacity,
                                                                         @Nullable
                                                                         @Nullable NSURL directoryURL)
        initWithMemoryCapacity:diskCapacity:directoryURL: Initializes an NSURLCache with the given capacity and directory.
        Parameters:
        memoryCapacity - the capacity, measured in bytes, for the cache in memory. Or 0 to disable memory cache.
        diskCapacity - the capacity, measured in bytes, for the cache on disk. Or 0 to disable disk cache.
        directoryURL - the path to a directory on disk where the cache data is stored. Or nil for default directory.
        Returns:
        an initialized NSURLCache, with the given capacity, optionally backed by disk. API-Since: 13.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.