[ 
https://issues.apache.org/jira/browse/HDDS-1802?focusedWorklogId=278567&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-278567
 ]

ASF GitHub Bot logged work on HDDS-1802:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jul/19 22:58
            Start Date: 17/Jul/19 22:58
    Worklog Time Spent: 10m 
      Work Description: arp7 commented on pull request #1100: HDDS-1802. Add 
Eviction policy for table cache.
URL: https://github.com/apache/hadoop/pull/1100#discussion_r304675885
 
 

 ##########
 File path: 
hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/CacheResult.java
 ##########
 @@ -0,0 +1,58 @@
+package org.apache.hadoop.utils.db.cache;
+
+import java.util.Objects;
+
+/**
+ * CacheResult which is returned as response for Key exist in cache or not.
+ * @param <CACHEVALUE>
+ */
+public class CacheResult<CACHEVALUE extends CacheValue> {
+
+  private CacheStatus cacheStatus;
+  private CACHEVALUE cachevalue;
+
+  public CacheResult(CacheStatus cacheStatus, CACHEVALUE cachevalue) {
+    this.cacheStatus = cacheStatus;
+    this.cachevalue = cachevalue;
+  }
+
+  public CacheStatus getCacheStatus() {
+    return cacheStatus;
+  }
+
+  public CACHEVALUE getValue() {
+    return cachevalue;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    CacheResult< ? > that = (CacheResult< ? >) o;
+    return cacheStatus == that.cacheStatus &&
+        Objects.equals(cachevalue, that.cachevalue);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(cacheStatus, cachevalue);
+  }
+
+  /**
+   * Status which tells whether key exists in cache or not.
+   */
+  public enum CacheStatus {
+    EXISTS, // When key exists in cache.
+
+    NOT_EXIST, // We guarantee that it does not exist. This will be returned
+    // when the key does not exist in cache, when cache clean up policy is
+    // NEVER.
+    CHECK_IN_TABLE  // This will be returned when the key does not exist in
 
 Review comment:
   Let's just call this MAY_EXIST. The cache doesn't know that it is part of a 
table.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 278567)
    Time Spent: 3h 10m  (was: 3h)

> Add Eviction policy for table cache
> -----------------------------------
>
>                 Key: HDDS-1802
>                 URL: https://issues.apache.org/jira/browse/HDDS-1802
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> In this Jira we will add eviction policy for table cache.
> In this Jira, we will add 2 eviction policies for the cache.
> NEVER, // Cache will not be cleaned up. This mean's the table maintains full 
> cache.
> AFTERFLUSH // Cache will be cleaned up, once after flushing to DB.
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to