@Override
    public <T> void getBinary(String cacheKey, Class<T> type,
            IAsyncResultHandler<ISignalReadStream<T>> handler) {
        boolean expired = false;
        ISignalReadStream<T> rval;
        Object object;

        IApimanBuffer buffer;
        synchronized (mapMutex) {
            object = objectCache.get(cacheKey);
            if (object != null) {
                Long expiresOn = expireOnMap.get(cacheKey);
                if (System.currentTimeMillis() > expiresOn) {
                    expired = true;
                }
            }
            buffer = dataCache.get(cacheKey);
            if (buffer == null) {
                object = null;
            }
        }

        if (object == null) {
            rval = null;
        } else if (expired) {
            synchronized (cacheSizeMutex) {
                synchronized (mapMutex) {
                    objectCache.remove(cacheKey);
                    expireOnMap.remove(cacheKey);
                    dataCache.remove(cacheKey);
                    cacheSize -= buffer.length();
                }
            }
            rval = null;
        } else {
            @SuppressWarnings("unchecked")
            final T head = (T) object;
            final IApimanBuffer data = buffer;
            rval = new ISignalReadStream<T>() {
                IAsyncHandler<IApimanBuffer> bodyHandler;
                IAsyncHandler<Void> endHandler;
                boolean finished = false;

                @Override
                public void bodyHandler(IAsyncHandler<IApimanBuffer> bodyHandler) {
                    this.bodyHandler = bodyHandler;
                }

                @Override
                public void endHandler(IAsyncHandler<Void> endHandler) {
                    this.endHandler = endHandler;
                }

                @Override
                public T getHead() {
                    return head;
                }

                @Override
                public boolean isFinished() {
                    return finished;
                }

                @Override
                public void abort(Throwable t) {
                    finished = true;
                }

                @Override
                public void transmit() {
                    bodyHandler.handle(data);
                    endHandler.handle(null);
                }
            };
        }

        handler.handle(AsyncResultImpl.create(rval));
    }
@see io.apiman.gateway.engine.components.ICacheStoreComponent#getBinary(java.lang.String, java.lang.Class, io.apiman.gateway.engine.async.IAsyncResultHandler)
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryCacheStoreComponent.java