Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.cache
Class ConcurrentLinkedHashCache<K,V>

    java.lang.Object
      org.apache.cassandra.cache.ConcurrentLinkedHashCache<K,V>

All Implemented Interfaces:
  ICache<K,V>

    public class ConcurrentLinkedHashCache<K,V>

extends java.lang.Object
implements ICache<K,V>

Wrapper so CLHM can implement ICache interface. (this is what you get for making library classes final.)

Field Summary
`static int` | `DEFAULT_CONCURENCY_LEVEL`

Constructor Summary
`ConcurrentLinkedHashCache(com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap<K,V> map)`

Method Summary
`long` | `capacity()`
`void` | `clear()`
`boolean` | `containsKey(K key)`
`static
`<K,V> ConcurrentLinkedHashCache<K,V>`
` | `create(long capacity)` Initialize a cache with weigher = Weighers.singleton() and initial capacity 0
`static
`<K,V> ConcurrentLinkedHashCache<K,V>`
` | `create(long weightedCapacity, com.googlecode.concurrentlinkedhashmap.Weigher<V> weigher)` Initialize a cache with initial capacity set to 0
`V` | `get(K key)`
`java.util.Set<K>` | `hotKeySet(int n)`
`boolean` | `isEmpty()`
`boolean` | `isPutCopying()`
`java.util.Set<K>` | `keySet()`
`void` | `put(K key, V value)`
`boolean` | `putIfAbsent(K key, V value)`
`void` | `remove(K key)`
`boolean` | `replace(K key, V old, V value)`
`void` | `setCapacity(long capacity)`
`int` | `size()`
`long` | `weightedSize()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CONCURENCY_LEVEL

    public static final int DEFAULT_CONCURENCY_LEVEL

See Also:
  Constant Field Values

Constructor Detail

### ConcurrentLinkedHashCache

    public ConcurrentLinkedHashCache(com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap<K,V> map)

Method Detail

### create

    public static <K,V> ConcurrentLinkedHashCache<K,V> create(long capacity)

  Initialize a cache with weigher = Weighers.singleton() and initial capacity 0

  Type Parameters:
    `K` - key type
    `V` - value type
  Parameters:
    `capacity` - cache weighted capacity
  Returns:
    initialized cache

### create

    public static <K,V> ConcurrentLinkedHashCache<K,V> create(long weightedCapacity,
                                                              com.googlecode.concurrentlinkedhashmap.Weigher<V> weigher)

  Initialize a cache with initial capacity set to 0

  Type Parameters:
    `K` - key type
    `V` - value type
  Parameters:
    `weightedCapacity` - cache weighted capacity
    `weigher` - The weigher to use
  Returns:
    initialized cache

### capacity

    public long capacity()

  Specified by:
    `capacity` in interface `ICache<K,V>`

### setCapacity

    public void setCapacity(long capacity)

  Specified by:
    `setCapacity` in interface `ICache<K,V>`

### isEmpty

    public boolean isEmpty()

### size

    public int size()

  Specified by:
    `size` in interface `ICache<K,V>`

### weightedSize

    public long weightedSize()

  Specified by:
    `weightedSize` in interface `ICache<K,V>`

### clear

    public void clear()

  Specified by:
    `clear` in interface `ICache<K,V>`

### get

    public V get(K key)

  Specified by:
    `get` in interface `ICache<K,V>`

### put

    public void put(K key,
                    V value)

  Specified by:
    `put` in interface `ICache<K,V>`

### putIfAbsent

    public boolean putIfAbsent(K key,
                               V value)

  Specified by:
    `putIfAbsent` in interface `ICache<K,V>`

### replace

    public boolean replace(K key,
                           V old,
                           V value)

  Specified by:
    `replace` in interface `ICache<K,V>`

### remove

    public void remove(K key)

  Specified by:
    `remove` in interface `ICache<K,V>`

### keySet

    public java.util.Set<K> keySet()

  Specified by:
    `keySet` in interface `ICache<K,V>`

### hotKeySet

    public java.util.Set<K> hotKeySet(int n)

  Specified by:
    `hotKeySet` in interface `ICache<K,V>`

### containsKey

    public boolean containsKey(K key)

  Specified by:
    `containsKey` in interface `ICache<K,V>`

### isPutCopying

    public boolean isPutCopying()

  Specified by:
    `isPutCopying` in interface `ICache<K,V>`
  Returns:
    true if the cache implementation inherently copies the cached values; otherwise, the caller should copy manually before caching shared values like Thrift ByteBuffers.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 The Apache Software Foundation