@Override
    public boolean exists(String key) {
        switch (keyMode) {
        case MONOPOLISTIC:
        case NAMESPACE:
            final String KEY = keyMode == KeyMode.MONOPOLISTIC ? key : calcCacheKeyNamespace(key);
            try {
                return getMemcachedClient().get(KEY) != null;
            } catch (Exception e) {
                throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
            }
        case XNAMESPACE:
            try {
                return getMemcachedClient().withNamespace(getName(),
                        new MemcachedClientCallable<Boolean>() {
                            @Override
                            public Boolean call(MemcachedClient client) throws InterruptedException,
                                    MemcachedException, TimeoutException {
                                return client.get(key) != null;
                            }

                        });
            } catch (Exception e) {
                throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
            }
        default:
            throw new IllegalStateException("Invalid key mode: " + keyMode);
        }
    }
@Override
    public boolean exists(String key) {
        switch (keyMode) {
        case MONOPOLISTIC:
        case NAMESPACE:
            final String KEY = keyMode == KeyMode.MONOPOLISTIC ? key : calcCacheKeyNamespace(key);
            try {
                return getMemcachedClient().get(KEY) != null;
            } catch (Exception e) {
                throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
            }
        case XNAMESPACE:
            try {
                return getMemcachedClient().withNamespace(getName(),
                        new MemcachedClientCallable<Boolean>() {
                            @Override
                            public Boolean call(MemcachedClient client) throws InterruptedException,
                                    MemcachedException, TimeoutException {
                                return client.get(key) != null;
                            }

                        });
            } catch (Exception e) {
                throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
            }
        default:
            throw new IllegalStateException("Invalid key mode: " + keyMode);
        }
    }
@ Override public boolean exists ( String key ) { switch ( keyMode ) { case MONOPOLISTIC : case NAMESPACE : final String KEY = keyMode == KeyMode . MONOPOLISTIC ? key : calcCacheKeyNamespace ( key ) ; try { return getMemcachedClient ( ) . get ( KEY ) != null ; } catch ( Exception e ) { throw e instanceof CacheException ? ( CacheException ) e : new CacheException ( e ) ; } case XNAMESPACE : try { return getMemcachedClient ( ) . withNamespace ( getName ( ) , new MemcachedClientCallable < Boolean > ( ) { @ Override public Boolean call ( MemcachedClient client ) throws InterruptedException , MemcachedException , TimeoutException { return client . get ( key ) != null ; } } ) ; } catch ( Exception e ) { throw e instanceof CacheException ? ( CacheException ) e : new CacheException ( e ) ; } default : throw new IllegalStateException ( "Invalid key mode: " + keyMode ) ; } }
{@inheritDoc}
{