/**
* @workflowDocu Simple command that uses a service with self-cleanup
*/
@JavaCommand
@CommandGroup("org.example")
public class CacheWriteRead {
/**
* @workflowDocu Service that cleans itself up
*/
@Service (1)
private CacheService cacheService;
/**
* @workflowDocu The Value to cache in the service
*/
@Persistent
private int valueToCache;
/**
* @workflowDocu The cache value before the write operation
*/
@Persistent(scope = FieldScope.WRITE_ONLY)
private int oldCacheValue;
/**
* @workflowDocu The cache value after the write operation
*/
@Persistent(scope = FieldScope.WRITE_ONLY)
private int newCacheValue;
@Run
public void cacheValue() { (2)
this.oldCacheValue = this.cacheService.getCachedValue();
this.cacheService.cacheValue(this.valueToCache);
this.newCacheValue = this.cacheService.getCachedValue();
}
}
Last updated 2025-04-07 09:26:29 +0200