com.maxifier.mxcache.storage.LongObjectStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mxcache-runtime Show documentation
Show all versions of mxcache-runtime Show documentation
Constains all classes necessary for launching a MxCache-instrumentated application
/*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.storage;
/**
* THIS IS GENERATED CLASS! DON'T EDIT IT MANUALLY!
*
* GENERATED FROM P2OStorage.template
*
*
* This is a basic implementation of cache storage. It is very similar to a usual map.
* It supports two main operations: load and save for corresponding key and value types.
*
*
* There are no storages with primitive value types due to the following:
*
*
* - using object as value allows to store special marker-values (UNDEFINED, exceptions, etc.) without an overhead;
*
* - it simplifies the code: you don't need to have a separate 'isCalculated(key)' method.
*
*
* @author Andrey Yakoushin ([email protected])
* @author Alexander Kochurov ([email protected])
*/
public interface LongObjectStorage extends Storage {
/**
* This method should extract value for given key from internal representation.
* It is guaranteed that it would be called with corresponding lock held.
* @param key key
* @return {@link Storage#UNDEFINED} if no value for key exists, value itself if it's set for given key.
*/
Object load(long key);
/**
* Saves a value to cache.
* It is guaranteed that it would be called with corresponding lock held.
* @param key cache key
* @param value cache value
*/
void save(long key, Object value);
}