Hi all.
We currently have available the
"org.apache.isis.applib.services.queryresultscache.QueryResultsCache” service
to cache the result of an Action invocation for the same transation.
So if we call a SAFE action that is costly to be computed, many times during
the same transaction, it’s only computed once, as the 2nd time and so on the
result will be obtained from a LocalThread cache.
Current usage idiom is something like:
// {{ relevantSnpGenotypes (programmatic - cached)
@Override
@Action(semantics = SemanticsOf.SAFE)
public SortedSet<IESG> relevantSnpGenotypes(final IE inputElement,
final Kit kit) {
return this.queryResultsCache.execute(new Callable<SortedSet<IESG>>() {
@Override
public SortedSet<IESG> call() throws Exception {
if (kit != null) {
return
kit.findAllAssociatedSNPGenotypesForInputElement(inputElement,
AlgorithmImplementation.this.IESGClass);
} else {
return Sets.newTreeSet();
}
}
}, Kit.class, "relevantSnpGenotypes", inputElement, kit);
}
// }}
// {{ injected: QueryResultsCache
@Inject
protected QueryResultsCache queryResultsCache;
// }}
But perhaps would it be possible to ease its usage by means of an annotation ?
Something like:
@Action(semantics = SemanticsOf.SAFE, cacheResults = true)
If so, the usage idiom would change to simply the action’s code, as the one
responsible for caching could be a Facet, for example?
// {{ relevantSnpGenotypes (programmatic - cached)
@Override
@Action(semantics = SemanticsOf.SAFE, cacheResults = true)
public SortedSet<IESG> relevantSnpGenotypes(final IE inputElement,
final Kit kit) {
if (kit != null) {
return
kit.findAllAssociatedSNPGenotypesForInputElement(inputElement,
AlgorithmImplementation.this.IESGClass);
} else {
return Sets.newTreeSet();
}
}
// }}
Just to know others opinion about if it has sense and if it would be possible.
I’m pretty sure this would be one of those “killer functions” for complex
Domains that would appear on a summary list, despite being currently being
available.
Thanks!
Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F
902 900 231 / 620 267 520
http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>
http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>
http://www.GesConsultor.com <http://www.gesconsultor.com/>
Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen
información reservada que no puede ser difundida. Si usted ha recibido este
correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al
remitente mediante reenvío a su dirección electrónica; no deberá copiar el
mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un
fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener
el contacto con Ud. Si quiere saber de qué información disponemos de Ud.,
modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al
efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección:
Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y
Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su
responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan
virus informáticos, y en caso que los tuvieran eliminarlos.