CacheDirective (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.protocol, class: CacheDirective

Package org.apache.hadoop.hdfs.protocol

# Class CacheDirective

java.lang.Object
org.apache.hadoop.hdfs.protocol.CacheDirective

All Implemented Interfaces:
  `org.apache.hadoop.util.IntrusiveCollection.Element`

@Private public final class CacheDirective extends Object implements org.apache.hadoop.util.IntrusiveCollection.Element
Namenode class that tracks state related to a cached path. This is an implementation class, not part of the public API.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CacheDirective(long id, String path, short replication, long expiryTime)`
  `CacheDirective(org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo info)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addBytesCached(long bytes)`
  `void`
  `addBytesNeeded(long bytes)`
  `void`
  `addFilesCached(long files)`
  `void`
  `addFilesNeeded(long files)`
  `boolean`
  `equals(Object o)`
  `long`
  `getBytesCached()`
  `long`
  `getBytesNeeded()`
  `long`
  `getExpiryTime()`
  `String`
  `getExpiryTimeString()`
  `long`
  `getFilesCached()`
  `long`
  `getFilesNeeded()`
  `long`
  `getId()`
  `org.apache.hadoop.util.IntrusiveCollection.Element`
  `getNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)`
  `String`
  `getPath()`
  `CachePool`
  `getPool()`
  `org.apache.hadoop.util.IntrusiveCollection.Element`
  `getPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)`
  `short`
  `getReplication()`
  `int`
  `hashCode()`
  `void`
  `insertInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev, org.apache.hadoop.util.IntrusiveCollection.Element next)`
  `boolean`
  `isInList(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)`
  `void`
  `removeInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)`
  `void`
  `resetStatistics()`
  Resets the byte and file statistics being tracked by this CacheDirective.
  `void`
  `setNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element next)`
  `void`
  `setPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev)`
  `org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry`
  `toEntry()`
  `org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo`
  `toInfo()`
  Returns a `CacheDirectiveInfo` based on this CacheDirective.
  `org.apache.hadoop.hdfs.protocol.CacheDirectiveStats`
  `toStats()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### CacheDirective

    public CacheDirective(org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo info)

  - ### CacheDirective

    public CacheDirective(long id, String path, short replication, long expiryTime)

- ## Method Details

  - ### getId

    public long getId()

  - ### getPath

    public String getPath()

  - ### getReplication

    public short getReplication()

  - ### getPool

    public CachePool getPool()

  - ### getExpiryTime

    public long getExpiryTime()
    Returns:
      When this directive expires, in milliseconds since Unix epoch

  - ### getExpiryTimeString

    public String getExpiryTimeString()
    Returns:
      When this directive expires, as an ISO-8601 formatted string.

  - ### toInfo

    public org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo toInfo()
    Returns a `CacheDirectiveInfo` based on this CacheDirective.

    This always sets an absolute expiry time, never a relative TTL.

  - ### toStats

    public org.apache.hadoop.hdfs.protocol.CacheDirectiveStats toStats()

  - ### toEntry

    public org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry toEntry()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### resetStatistics

    public void resetStatistics()
    Resets the byte and file statistics being tracked by this CacheDirective.

  - ### getBytesNeeded

    public long getBytesNeeded()

  - ### addBytesNeeded

    public void addBytesNeeded(long bytes)

  - ### getBytesCached

    public long getBytesCached()

  - ### addBytesCached

    public void addBytesCached(long bytes)

  - ### getFilesNeeded

    public long getFilesNeeded()

  - ### addFilesNeeded

    public void addFilesNeeded(long files)

  - ### getFilesCached

    public long getFilesCached()

  - ### addFilesCached

    public void addFilesCached(long files)

  - ### insertInternal

    public void insertInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev, org.apache.hadoop.util.IntrusiveCollection.Element next)
    Specified by:
      `insertInternal` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### setPrev

    public void setPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev)
    Specified by:
      `setPrev` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### setNext

    public void setNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element next)
    Specified by:
      `setNext` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### removeInternal

    public void removeInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
    Specified by:
      `removeInternal` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### getPrev

    public org.apache.hadoop.util.IntrusiveCollection.Element getPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
    Specified by:
      `getPrev` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### getNext

    public org.apache.hadoop.util.IntrusiveCollection.Element getNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
    Specified by:
      `getNext` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`

  - ### isInList

    public boolean isInList(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
    Specified by:
      `isInList` in interface `org.apache.hadoop.util.IntrusiveCollection.Element`