@Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter out) { String name = checkNotNull(Iterables.getFirst(parameters.get("cache"), null), "cache"); String scopeString = Iterables.getFirst(parameters.get("scope"), "LOCAL"); InvalidationScope scope = InvalidationScope.valueOf(scopeString.toUpperCase()); Collection<String> keys = parameters.get("key"); boolean invalidateAll = keys.isEmpty(); CacheHandle handle = _registry.lookup(name, false); if (handle == null) { out.println("Cache not found: " + name); return; } if (invalidateAll) { handle.invalidateAll(scope); } else { handle.invalidateAll(scope, keys); } out.println("Done!"); } }
MultivaluedMap<String,String> form = new Form(); form.putSingle("cache", event.getCache()); form.putSingle("scope", scope.name().toLowerCase()); if (event.hasKeys()) { form.put("key", ImmutableList.copyOf(event.getKeys()));
MultivaluedMap<String,String> form = new Form(); form.putSingle("cache", event.getCache()); form.putSingle("scope", scope.name().toLowerCase()); if (event.hasKeys()) { form.put("key", ImmutableList.copyOf(event.getKeys()));
@Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter out) { String name = checkNotNull(Iterables.getFirst(parameters.get("cache"), null), "cache"); String scopeString = Iterables.getFirst(parameters.get("scope"), "LOCAL"); InvalidationScope scope = InvalidationScope.valueOf(scopeString.toUpperCase()); Collection<String> keys = parameters.get("key"); boolean invalidateAll = keys.isEmpty(); CacheHandle handle = _registry.lookup(name, false); if (handle == null) { out.println("Cache not found: " + name); return; } if (invalidateAll) { handle.invalidateAll(scope); } else { handle.invalidateAll(scope, keys); } out.println("Done!"); } }