/** * @param cacheName * @param key * @return ICacheElement<K, V> if found. * @throws IOException */ @Override public ICacheElement<K, V> get( String cacheName, K key ) throws IOException { return get( cacheName, key, getListenerId() ); }
/** * If allow get is true, we will issue a getmatching query. * <p> * @param cacheName * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache matching the pattern. * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern ) throws IOException { return getMatching( cacheName, pattern, getListenerId() ); }
/** * Uses the default listener id and calls the next remove method. * <p> * @see org.apache.commons.jcs.engine.behavior.ICacheService#remove(String, Object) */ @Override public void remove( String cacheName, K key ) throws IOException { remove( cacheName, key, getListenerId() ); }
/** * @param item * @throws IOException */ @Override public void update( ICacheElement<K, V> item ) throws IOException { update( item, getListenerId() ); }
LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); service.update( element1 );
LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); service.update( element ); if ( show ) service.remove( region, key ); if ( show ) Object obj = service.get( region, key ); if ( show && obj != null )
lattr2.setTcpServer( "localhost:1107" ); LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); ICacheElement<String, String> result = service.get( "test", "key" );
lattr2.setTcpServer( "localhost:1108" ); LateralTCPService<String, Integer> service = new LateralTCPService<String, Integer>( lattr2 ); service.setListenerId( 123456 ); Map<String, ICacheElement<String, Integer>> result = service.getMatching( "test", keyprefix1 + ".+" );
new LateralTCPService<GroupAttrName<String>, String>( lattr2 ); service.setListenerId( 123459 ); Set<GroupAttrName<String>> result = service.getKeySet("test");
/** * @param cacheName * @throws IOException */ @Override public void removeAll( String cacheName ) throws IOException { removeAll( cacheName, getListenerId() ); }
/** * Gets multiple items from the cache based on the given set of keys. * <p> * @param cacheName * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys ) throws IOException { return getMultiple( cacheName, keys, getListenerId() ); }
/** * This issues a separate get for each item. * <p> * TODO We should change this. It should issue one request. * <p> * @param cacheName * @param keys * @param requesterId * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys * @throws IOException */ @Override public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId ) throws IOException { Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>(); if ( keys != null && !keys.isEmpty() ) { for (K key : keys) { ICacheElement<K, V> element = get( cacheName, key ); if ( element != null ) { elements.put( key, element ); } } } return elements; }
service = new LateralTCPService<K, V>( lca );
LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); service.update( element1 );
LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); service.update( element ); if ( show ) service.remove( region, key ); if ( show ) Object obj = service.get( region, key ); if ( show && obj != null )
lattr2.setTcpServer( "localhost:1107" ); LateralTCPService<String, String> service = new LateralTCPService<String, String>( lattr2 ); service.setListenerId( 123456 ); ICacheElement<String, String> result = service.get( "test", "key" );
lattr2.setTcpServer( "localhost:1108" ); LateralTCPService<String, Integer> service = new LateralTCPService<String, Integer>( lattr2 ); service.setListenerId( 123456 ); Map<String, ICacheElement<String, Integer>> result = service.getMatching( "test", keyprefix1 + ".+" );
new LateralTCPService<GroupAttrName<String>, String>( lattr2 ); service.setListenerId( 123459 ); Set<GroupAttrName<String>> result = service.getKeySet("test");
/** * @param item * @throws IOException */ @Override public void update( ICacheElement<K, V> item ) throws IOException { update( item, getListenerId() ); }
/** * @param cacheName * @throws IOException */ @Override public void removeAll( String cacheName ) throws IOException { removeAll( cacheName, getListenerId() ); }