com.maxifier.mxcache.impl.caches.def.ObjectStorageImpl Maven / Gradle / Ivy
/*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.impl.caches.def;
import com.maxifier.mxcache.storage.*;
/**
* ObjectStorageImpl
*
* @author Andrey Yakoushin ([email protected])
* @author Alexander Kochurov ([email protected])
*/
public class ObjectStorageImpl implements ObjectStorage {
private volatile Object value = UNDEFINED;
@Override
public Object load() {
return value;
}
@Override
public void save(T v) {
value = v;
}
@Override
public void clear() {
value = UNDEFINED;
}
@Override
public int size() {
return value == UNDEFINED ? 0 : 1;
}
}