org.elasticsearch.cache.memory
Class ByteBufferCache

java.lang.Object
  extended by org.elasticsearch.common.component.AbstractComponent
      extended by org.elasticsearch.cache.memory.ByteBufferCache
All Implemented Interfaces:
ByteBufferAllocator

public class ByteBufferCache
extends AbstractComponent
implements ByteBufferAllocator


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.lucene.store.bytebuffer.ByteBufferAllocator
ByteBufferAllocator.Cleaner, ByteBufferAllocator.Type
 
Field Summary
 
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
componentSettings, logger, settings
 
Constructor Summary
ByteBufferCache()
           
ByteBufferCache(int bufferSizeInBytes, int cacheSizeInBytes, boolean direct)
           
ByteBufferCache(Settings settings)
           
 
Method Summary
 ByteBuffer allocate(ByteBufferAllocator.Type type)
          Allocate a byte buffer for the specific type.
 void close()
          Close the allocator, releasing any cached buffers for example.
 boolean direct()
           
 void release(ByteBuffer buffer)
          Release the buffer.
 int sizeInBytes(ByteBufferAllocator.Type type)
          The size (in bytes) that is allocated for the provided type.
 
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
nodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferCache

public ByteBufferCache()

ByteBufferCache

public ByteBufferCache(int bufferSizeInBytes,
                       int cacheSizeInBytes,
                       boolean direct)

ByteBufferCache

@Inject
public ByteBufferCache(Settings settings)
Method Detail

direct

public boolean direct()

close

public void close()
Description copied from interface: ByteBufferAllocator
Close the allocator, releasing any cached buffers for example.

Specified by:
close in interface ByteBufferAllocator

sizeInBytes

public int sizeInBytes(ByteBufferAllocator.Type type)
Description copied from interface: ByteBufferAllocator
The size (in bytes) that is allocated for the provided type.

Specified by:
sizeInBytes in interface ByteBufferAllocator

allocate

public ByteBuffer allocate(ByteBufferAllocator.Type type)
                    throws IOException
Description copied from interface: ByteBufferAllocator
Allocate a byte buffer for the specific type.

Specified by:
allocate in interface ByteBufferAllocator
Throws:
IOException

release

public void release(ByteBuffer buffer)
Description copied from interface: ByteBufferAllocator
Release the buffer.

Specified by:
release in interface ByteBufferAllocator


Copyright © 2009-2012. All Rights Reserved.