@Override public CacheHandle lookup(String name, boolean create) { return _root.lookup(_prefix + name, create); }
@Override public CacheHandle lookup(String name, boolean create) { return _root.lookup(_prefix + name, create); }
public MaintenanceScheduler(MaintenanceDAO maintenanceDao, Optional<TableMutexManager> tableMutexManager, String selfDataCenter, CacheRegistry cacheRegistry, MoveTableTask task) { _maintDao = checkNotNull(maintenanceDao, "maintenanceDao"); _tableMutexManager = checkNotNull(tableMutexManager, "tableMutexManager"); _selfDataCenter = checkNotNull(selfDataCenter, "selfDataCenter"); _tableCacheHandle = cacheRegistry.lookup("tables", true); cacheRegistry.addListener(this); task.setScheduler(this); }
public MaintenanceScheduler(MaintenanceDAO maintenanceDao, Optional<TableMutexManager> tableMutexManager, String selfDataCenter, CacheRegistry cacheRegistry, MoveTableTask task) { _maintDao = checkNotNull(maintenanceDao, "maintenanceDao"); _tableMutexManager = checkNotNull(tableMutexManager, "tableMutexManager"); _selfDataCenter = checkNotNull(selfDataCenter, "selfDataCenter"); _tableCacheHandle = cacheRegistry.lookup("tables", true); cacheRegistry.addListener(this); task.setScheduler(this); }
@Override public void invalidateAll() { if(_cacheRegistry != null) { for(String name : _allAvailableCaches.keySet()) { // There is a potential race condition here since the cache is added to _allAvailableCaches // then subsequently added to _cacheRegistry in createCache(), making it possible for a value to // be cached but not invalidated on this call. However, to avoid this issue all caches used by // this manager are pre-created in ApiKeyRealm.onInit(), so in practice this can never happen. CacheHandle cacheHandle = _cacheRegistry.lookup(name, false); cacheHandle.invalidateAll(InvalidationScope.GLOBAL); } } else { for(GuavaCache cache : _allAvailableCaches.values()) { cache.clear(); } } }
@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!"); } }
@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!"); } }
_fullConsistencyTimeProvider = checkNotNull(fullConsistencyTimeProvider, "fullConsistencyTimeProvider"); _tableChangesEnabled = checkNotNull(tableChangesEnabled, "tableChangesEnabled"); _tableCacheHandle = cacheRegistry.lookup("tables", true); _placementsUnderMove = checkNotNull(placementsUnderMove, "placementsUnderMove"); _purgesBlocked = purgesBlocked;
_fullConsistencyTimeProvider = checkNotNull(fullConsistencyTimeProvider, "fullConsistencyTimeProvider"); _tableChangesEnabled = checkNotNull(tableChangesEnabled, "tableChangesEnabled"); _tableCacheHandle = cacheRegistry.lookup("tables", true); _placementsUnderMove = checkNotNull(placementsUnderMove, "placementsUnderMove"); _purgesBlocked = purgesBlocked;