@CachePut(cacheName = "simpleCache") public void multiCacheValues(Long id, @CacheValue SampleObject instance, @CacheValue SampleObject anotherInstance) { }
@Override @CachePut public void put(String id, @CacheValue Object value) { }
@Override @CachePut public void put(String id, @CacheValue Object value) { }
@CachePut(cacheName = "simpleCache") public void simplePut(Long id, @CacheValue SampleObject instance) { }
@CachePut public void put(long id, @CacheValue Object object) { }
@CachePut(cacheName = "simpleCache", afterInvocation = false, cacheFor = Exception.class, noCacheFor = RuntimeException.class) public void fullPutConfig(@CacheKey Long id, @CacheValue SampleObject instance) { }
@Override @CachePut(afterInvocation = false) public void earlyPutWithException(@CacheKey String id, @CacheValue Object value, boolean matchFilter) { throwException(matchFilter); }
@Override @CachePut(afterInvocation = false) public void earlyPut(String id, @CacheValue Object value) { Object key = SimpleKeyGenerator.generateKey(id); Cache.ValueWrapper valueWrapper = defaultCache.get(key); if (valueWrapper == null) { throw new AssertionError("Excepted value to be put in cache with key " + key); } Object actual = valueWrapper.get(); if (value != actual) { // instance check on purpose throw new AssertionError("Wrong value set in cache with key " + key + ". " + "Expected=" + value + ", but got=" + actual); } }
@Override @CachePut(afterInvocation = false) public void earlyPut(String id, @CacheValue Object value) { Object key = SimpleKeyGenerator.generateKey(id); Cache.ValueWrapper valueWrapper = defaultCache.get(key); if (valueWrapper == null) { throw new AssertionError("Excepted value to be put in cache with key " + key); } Object actual = valueWrapper.get(); if (value != actual) { // instance check on purpose throw new AssertionError("Wrong value set in cache with key " + key + ". " + "Expected=" + value + ", but got=" + actual); } }
@Override @CachePut(cacheFor = UnsupportedOperationException.class) public void putWithException(@CacheKey String id, @CacheValue Object value, boolean matchFilter) { throwException(matchFilter); }
@Override @CachePut(cacheFor = UnsupportedOperationException.class) public void putWithException(@CacheKey String id, @CacheValue Object value, boolean matchFilter) { throwException(matchFilter); }
@Override @CachePut(afterInvocation = false) public void earlyPutWithException(@CacheKey String id, @CacheValue Object value, boolean matchFilter) { throwException(matchFilter); }
/** * Save or update a setting and return the corresponding identifier. The system variable is not updated. * * @param name * The configuration name. * @param value * The new value. */ @POST @PUT @Path("{name}") @CachePut(cacheName = "configuration") public void put(@CacheKey @PathParam("name") final String name, @CacheValue @NotBlank @NotNull final String value) { put(name, value, false); }
/** * Save or update a setting and return the corresponding identifier. * * @param name * The configuration name. * @param value * The new value. * @param system * When <code>true</code>, the system variable is also updated. */ @POST @PUT @Path("{name}/{system}") @CachePut(cacheName = "configuration") public void put(@CacheKey @PathParam("name") final String name, @CacheValue @NotBlank @NotNull final String value, @PathParam("system") final boolean system) { final SystemConfiguration setting = repository.findByName(name); if (setting == null) { final SystemConfiguration entity = new SystemConfiguration(); entity.setName(name); entity.setValue(cryptoHelper.encrypt(value)); repository.saveAndFlush(entity); } else { setting.setValue(cryptoHelper.encrypt(value)); } if (system) { // Also set the value in the system, not hashed form System.setProperty(name, value); } }
@CachePut(cacheName = "books") @Override public Book createBook(@CacheKey @CacheValue Book book) { return baseDao.createBook(book); }
@CachePut(cacheName = "books") @Override public Book createBook(@CacheKey @CacheValue Book book) { return baseDao.createBook(book); }
@CachePut(cacheName = "books") @Override public Book createBook(@CacheKey @CacheValue Book book) { return baseDao.createBook(book); }
@CachePut(cacheName = "books") @Override public Book createBook(@CacheKey @CacheValue Book book) { return baseDao.createBook(book); }
/** * Create a new group. There is no synchronized block, so error could occur; this is assumed for performance * purpose. * * @param dn * The DN of new customer. Must ends with the OU. * @param ou * The formatted OU. */ @CachePut(cacheName = "customers-by-id") public void create(@CacheKey final String baseDn, @CacheKey final String ou, @CacheValue final String dn) { // Invalidate the customers set cacheManager.getCache("customers").evict(baseDn); // First create the LDAP entry log.info("Customer (OU) {} will be created as {}", ou, dn); final DirContextAdapter context = new DirContextAdapter(dn); context.setAttributeValues(UserLdapRepository.OBJECT_CLASS, new String[] { CUSTOMER_OF_PROJECT }); mapToContext(ou, context); getUser().getTemplate().bind(context); }