All Downloads are FREE. Search and download functionalities are using the official Maven repository.

csip.MemResultStore Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.6.30
Show newest version
/*
 * 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