Class ForcedDiskCacheStorage

  • All Implemented Interfaces:
    org.apache.hc.client5.http.cache.HttpCacheStorage

    public class ForcedDiskCacheStorage
    extends java.lang.Object
    implements org.apache.hc.client5.http.cache.HttpCacheStorage
    Forced persistent cache storage. The implementation will cache the response to disk and consider it valid for a configurable duration, the default is 20 hours.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.time.Duration DEFAULT_TTL  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​org.apache.hc.client5.http.cache.HttpCacheEntry> getEntries​(java.util.Collection<java.lang.String> keys)  
      org.apache.hc.client5.http.cache.HttpCacheEntry getEntry​(java.lang.String key)  
      void putEntry​(java.lang.String key, org.apache.hc.client5.http.cache.HttpCacheEntry entry)  
      void removeEntry​(java.lang.String key)  
      void updateEntry​(java.lang.String key, org.apache.hc.client5.http.cache.HttpCacheCASOperation casOperation)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_TTL

        public static final java.time.Duration DEFAULT_TTL
    • Constructor Detail

      • ForcedDiskCacheStorage

        public ForcedDiskCacheStorage​(java.lang.String storagePath)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • ForcedDiskCacheStorage

        public ForcedDiskCacheStorage​(java.lang.String storagePath,
                                      java.time.Duration timeToLive)
                               throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • putEntry

        public void putEntry​(java.lang.String key,
                             org.apache.hc.client5.http.cache.HttpCacheEntry entry)
                      throws org.apache.hc.client5.http.cache.ResourceIOException
        Specified by:
        putEntry in interface org.apache.hc.client5.http.cache.HttpCacheStorage
        Throws:
        org.apache.hc.client5.http.cache.ResourceIOException
      • getEntry

        public org.apache.hc.client5.http.cache.HttpCacheEntry getEntry​(java.lang.String key)
                                                                 throws org.apache.hc.client5.http.cache.ResourceIOException
        Specified by:
        getEntry in interface org.apache.hc.client5.http.cache.HttpCacheStorage
        Throws:
        org.apache.hc.client5.http.cache.ResourceIOException
      • removeEntry

        public void removeEntry​(java.lang.String key)
                         throws org.apache.hc.client5.http.cache.ResourceIOException
        Specified by:
        removeEntry in interface org.apache.hc.client5.http.cache.HttpCacheStorage
        Throws:
        org.apache.hc.client5.http.cache.ResourceIOException
      • updateEntry

        public void updateEntry​(java.lang.String key,
                                org.apache.hc.client5.http.cache.HttpCacheCASOperation casOperation)
                         throws org.apache.hc.client5.http.cache.ResourceIOException
        Specified by:
        updateEntry in interface org.apache.hc.client5.http.cache.HttpCacheStorage
        Throws:
        org.apache.hc.client5.http.cache.ResourceIOException
      • getEntries

        public java.util.Map<java.lang.String,​org.apache.hc.client5.http.cache.HttpCacheEntry> getEntries​(java.util.Collection<java.lang.String> keys)
                                                                                                         throws org.apache.hc.client5.http.cache.ResourceIOException
        Specified by:
        getEntries in interface org.apache.hc.client5.http.cache.HttpCacheStorage
        Throws:
        org.apache.hc.client5.http.cache.ResourceIOException