Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.transistore.service;
  
  
  
 public class BasicTSEntry extends StoredEntry<BasicTSKey>
 {
     /*
     /**********************************************************************
     /* Entry contents
     /**********************************************************************
      */

    
Key used to refer to this entry
 
     public final BasicTSKey key;

    
"Raw" serialized contents of the entry
 
     public final Storable rawEntry;

    
Timestamp of actual creation of entry; used for TTL calculations. Unlike insertion time (which may change), this will not be changed once entry has been added.
 
     public final long creationTime;

    
Maximum time-to-live, in seconds, since creation. After this time is up, entry may be auto-expired, regardless of other settings.

This value may be sent by client; if not, a default value will be used.

Note that this setting has higher precedence that minTTLSinceAccessSecs, meaning that it will effectively limit maximum time an entry can live.

 
     public final int maxTTLSecs;

    
Minimum time-to-live, in seconds, since the entry was last accessed.

This value may be sent by client; if not, a default value will be used.

Note that this value has lower precedence than maxTTLSecs, meaning that even if entry is regularly accessed, it can not "live forever".

 
     public final int minTTLSinceAccessSecs;
 
     
     /*
     /**********************************************************************
     /* Construction
     /**********************************************************************
      */

    
Constructor used by unit tests, synchronization code
 
     protected BasicTSEntry(BasicTSKey keyStorable rawEntry,
             long creationTimeint minTTLSecsint maxTTLSecs,
             LastAccessUpdateMethod lastAccessUpdatedMethod)
     {
         this. = key;
         this. = rawEntry;
         this. = creationTime;
         this. = minTTLSecs;
         this. = maxTTLSecs;
         this. = lastAccessUpdatedMethod;
     }
 
     /*
     /**********************************************************************
     /* Simple accessor implementations
     /**********************************************************************
      */
 
     @Override
     public BasicTSKey getKey() { return ; }
 
     @Override
     public Storable getRaw() { return ; }
 
     @Override
         return ;
     }
 
     @Override
     public int getMinTTLSinceAccessSecs() {
         return ;
    }
    @Override
    public int getMaxTTLSecs() {
        return ;
    }
    @Override
    public long getCreationTime() {
        return ;
    }
    /*
    /**********************************************************************
    /* Derived accessor implementations
    /**********************************************************************
     */
    @Override
    public boolean hasExceededMaxTTL(long currentTime
    {
        return (currentTime >= ( + 1000L * ));
    }
    @Override
    public boolean hasExceededMinTTL(long currentTime
    {
        return (currentTime >= ( + 1000L * ));
    }
    
    @Override
    public boolean usesLastAccessTime()
    {
        return (method != null) && !method.meansNoUpdate();
    }
    
    @Override
    public boolean hasExceededLastAccessTTL(long currentTimelong lastAccess)
    {
        // first: if no last-access info found, assume creation time is to be used
        // (or, if somehow last-access timestamp was corrupt?)
        long lastAccessMsecs = Math.max(lastAccess);
        return (currentTime >= (lastAccessMsecs + *1000));
    }
    @Override
    public boolean insertedBefore(long timestamp) {
        return .getLastModified() < timestamp;
    }
    @Override
    public boolean createdBefore(long timestamp) {
        return  < timestamp;
    }
    @Override
    public int routingHashUsing(EntryKeyConverter<BasicTSKeyhasher)
    {
        return hasher.routingHashFor();
    }
    /*
    /**********************************************************************
    /* Overridden standard methods
    /**********************************************************************
     */
    
    // Override for diagnostics, debugging:
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder(60)
            .append("[key='").append();
        sb.append(", storageLength=").append(.getStorageLength());
        sb.append(", compressed=").append(.getCompression());
        sb.append(']');
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X