public void remove(K key) { boolean exists = innerCache.containsKey(key); innerCache.remove(key); if (exists) { getBroadcaster().announce(syncEntity, Broadcaster.Event.DROP.getType(), key.toString()); } }
/** * If cacheKey has "/", will lead to this method. */ @RequestMapping(value = "/{entity}/{event}", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public void wipeCacheWithRequestBody(@PathVariable String entity, @PathVariable String event, @RequestBody String cacheKey) throws IOException { cacheService.notifyMetadataChange(entity, Broadcaster.Event.getEvent(event), cacheKey); }
public void remove(K key) { boolean exists = innerCache.containsKey(key); innerCache.remove(key); if (exists) { getBroadcaster().announce(syncEntity, Broadcaster.Event.DROP.getType(), key.toString()); } }
public void put(K key, V value) { boolean exists = innerCache.containsKey(key); innerCache.put(key, value); if (!exists) { getBroadcaster().announce(syncEntity, Broadcaster.Event.CREATE.getType(), key.toString()); } else { getBroadcaster().announce(syncEntity, Broadcaster.Event.UPDATE.getType(), key.toString()); } }
private static void updateMeta(KylinConfig config) { String[] nodes = config.getRestServers(); for (String node : nodes) { RestClient restClient = new RestClient(node); try { logger.info("update meta cache for " + node); restClient.wipeCache(Broadcaster.SYNC_ALL, Broadcaster.Event.UPDATE.getType(), Broadcaster.SYNC_ALL); } catch (IOException e) { logger.error(e.getMessage()); } } }
public void put(K key, V value) { boolean exists = innerCache.containsKey(key); innerCache.put(key, value); if (!exists) { getBroadcaster().announce(syncEntity, Broadcaster.Event.CREATE.getType(), key.toString()); } else { getBroadcaster().announce(syncEntity, Broadcaster.Event.UPDATE.getType(), key.toString()); } }
private static void updateMeta(KylinConfig config) { String[] nodes = config.getRestServers(); for (String node : nodes) { RestClient restClient = new RestClient(node); try { logger.info("update meta cache for " + node); restClient.wipeCache(Broadcaster.SYNC_ALL, Broadcaster.Event.UPDATE.getType(), Broadcaster.SYNC_ALL); } catch (IOException e) { logger.error(e.getMessage()); } } }
/** * Wipe cache on this node */ @RequestMapping(value = "/{entity}/{cacheKey}/{event}", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public void wipeCache(@PathVariable String entity, @PathVariable String event, @PathVariable String cacheKey) throws IOException { cacheService.notifyMetadataChange(entity, Broadcaster.Event.getEvent(event), cacheKey); }