Package org.opensaml.storage.impl.memcached

# 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 Summary

Constructors
Constructor
Description
`MemcachedStorageRecord(String val, Long exp)`
Creates a new instance with specific record version.

## Method Summary

Modifier and Type
Method
Description
`static int`
`expiry(Long exp)`
Converts a `StorageRecord.getExpiration()` value in milliseconds to the corresponding value in seconds.
`int`
`getExpiry()`
Gets the expiration date as an integer representing seconds since the Unix epoch, 1970-01-01T00:00:00.
`protected void`
`setVersion(long version)`
Sets the record version.

### Methods inherited from class org.opensaml.storage.StorageRecord

`getExpiration, getValue, getValue, getVersion, incrementVersion, isExpired, isValid, setExpiration, setValue, setValue`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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.