Class MemcachedStorageRecord<T>

java.lang.Object
org.opensaml.storage.StorageRecord<T>
org.opensaml.storage.impl.memcached.MemcachedStorageRecord<T>
Type Parameters:
T - type of object

public class MemcachedStorageRecord<T> extends StorageRecord<T>
Storage record implementation for use with MemcachedStorageService.
  • Constructor Details

    • MemcachedStorageRecord

      public MemcachedStorageRecord(@Nonnull @NotEmpty String val, @Nullable Long exp)
      Creates a new instance with specific record version.
      Parameters:
      val - Stored value.
      exp - Expiration instant in milliseconds, null for infinite expiration.
  • Method Details

    • expiry

      public static int expiry(Long exp)
      Converts a StorageRecord.getExpiration() value in milliseconds to the corresponding value in seconds.
      Parameters:
      exp - the expiration value
      Returns:
      0 if given expiration is null, otherwise exp/1000.
    • getExpiry

      public int getExpiry()
      Gets the expiration date as an integer representing seconds since the Unix epoch, 1970-01-01T00:00:00. The value provided by this method is suitable for representing the memcached entry expiration.
      Returns:
      0 if expiration is null, otherwise getExpiration()/1000.
    • setVersion

      protected void setVersion(@Positive long version)
      Sets the record version.
      Overrides:
      setVersion in class StorageRecord<T>
      Parameters:
      version - Record version; must be positive.