@Override
    public <T> ISignalWriteStream putBinary(final String cacheKey, final T jsonObject, final long timeToLive)
            throws IOException {
        final IApimanBuffer dataBuffer = bufferFactory.createBuffer(0);
        return new ISignalWriteStream() {
            private boolean finished = false;
            private boolean aborted = false;
            @Override
            public void abort(Throwable t) {
                aborted = true;
                finished = false;
            }
            @Override
            public boolean isFinished() {
                return finished;
            }
            @Override
            public void write(IApimanBuffer chunk) {
                dataBuffer.append(chunk);
            }
            @Override
            public void end() {
                if (!aborted) {
                    synchronized (mutex) {
                        InfinispanCacheEntry entry = (InfinispanCacheEntry) getCache().get(cacheKey);
                        if (entry == null) {
                            entry = new InfinispanCacheEntry();
                        }
                        entry.setHead(jsonObject);
                        entry.setExpiresOn(System.currentTimeMillis() + (timeToLive * 1000));
                        entry.setData(dataBuffer.getBytes());
                        getCache().put(cacheKey, entry);
                    }
                }
            }
        };
    }
@see io.apiman.gateway.engine.components.ICacheStoreComponent#putBinary(java.lang.String, java.lang.Object, long)
gateway/engine/ispn/src/main/java/io/apiman/gateway/engine/ispn/InfinispanCacheStoreComponent.java