csip.MemResultStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of csip-core Show documentation
Show all versions of csip-core Show documentation
The Cloud Services Integration Platform is a SoA implementation to offer a Model-as-a-Service framework, Application Programming Interface, deployment infrastructure, and service implementations for environmental modeling.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package csip;
import csip.utils.LRUCache;
import org.codehaus.jettison.json.JSONArray;
/**
*
* @author od
*/
public class MemResultStore implements ResultStore {
LRUCache cache;
MemResultStore(int limit) {
cache = new LRUCache<>(limit);
}
@Override
public synchronized JSONArray getResult(String digest) {
return cache.get(digest);
}
@Override
public synchronized void putResult(String digest, JSONArray results) {
cache.put(digest, results);
}
@Override
public synchronized void purge() {
cache.clear();
}
@Override
public void close() throws Exception {
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy