Author: echatellier Date: 2012-04-10 17:25:19 +0200 (Tue, 10 Apr 2012) New Revision: 3678 Url: http://forge.codelutin.com/repositories/revision/isis-fish/3678 Log: Clear result simulation cache when necessary Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java 2012-04-10 13:20:22 UTC (rev 3677) +++ trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorage.java 2012-04-10 15:25:19 UTC (rev 3678) @@ -116,6 +116,17 @@ } } + /** + * Result can be removed from cache when computed result (from multiple step) + * become invalidated by new step result. + * + * @param name result name to remove + */ + protected void removeInCache(String name) { + cache.remove(name); + cacheContext.remove(name); + } + protected MatrixND getInCache(TimeStep step, String name) { // do not use toString for step (depend on i18n) String key = step.getStep() + ":" + name; @@ -357,6 +368,12 @@ addAvailableResult(step, name); putInCache(step, name, newMat, tx); + + // remove from cache result computed by #getMatrix(name) + // beacause, if a new step is added, result become false + // but DO NOT REMOVE result named step + name + removeInCache(name); + } catch (TopiaException eee) { log.warn("Can't add result '" + name + "' at step " + step, eee); }