public static void main ( String [ ] args ) { // set verboseMode based on the environment variable verboseMode = ( "true" . equals ( System . getenv ( "EVCACHE_SAMPLE_VERBOSE" ) ) ) ; if ( verboseMode ) { System . out . println ( "To run this sample app without using Gradle:" ) ; System . out . println ( "java -cp " + System . getProperty ( "java.class.path" ) + " com.netflix.evcache.sample.EVCacheClientSample" ) ; } try { EVCacheClientSample evCacheClientSample = new EVCacheClientSample ( ) ; // Set ten keys to different values for ( int i = 0 ; i < 10 ; i ++ ) { String key = "key_" + i ; String value = "data_" + i ; // Set the TTL to 24 hours int ttl = 86400 ; evCacheClientSample . setKey ( key , value , ttl ) ; } // Do a "get" for each of those same keys for ( int i = 0 ; i < 10 ; i ++ ) { String key = "key_" + i ; String value = evCacheClientSample . getKey ( key ) ; System . out . println ( "Get of " + key + " returned " + value ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } // We have to call System.exit() now, because some background // threads were started without the "daemon" flag. This is // probably a mistake somewhere, but hey, this is only a sample app. System . exit ( 0 ) ; }
Main Program which does some simple sets and gets .