title: How to disable Guava caching?
body: <p><a href="http://code.google.com/p/guava-libraries/downloads/detail?name=JavaCachingwithGuava.pdf&amp;can=2&amp;q=" rel="nofollow">JavaCachingWithGuava</a> suggests the canonical way to turn off caching is to set <em>maximumSize=0</em>. 
  However, I'd expect the test below to pass:</p>
  
  <pre><code>public class LoadingCacheTest {
      private static final Logger LOG = LoggerFactory.getLogger(LoadingCacheTest.class);
  
      LoadingCache&lt;String, Long&gt; underTest;
  
      @Before
      public void setup() throws Exception {
          underTest = CacheBuilder.from("maximumSize=0").newBuilder()
                  .recordStats()
                  .removalListener(new RemovalListener&lt;String, Long&gt;() {
                      @Override
                      public void onRemoval(RemovalNotification&lt;String, Long&gt; removalNotification) {
                          LOG.info(String.format("%s cached value %s for key %s is evicted.", removalNotification.getCause().name(), removalNotification.getValue(), removalNotification.getKey()));
                      }
                  })
                  .build(new CacheLoader&lt;String, Long&gt;() {
                      private final AtomicLong al = new AtomicLong(0);
                      @Override
                      public Long load(@NotNull final String key) throws Exception {
                          LOG.info(String.format("Cache miss for key '%s'.", key));
                          return al.incrementAndGet();
                      }
                  });
      }
  
      @Test
      public void testAlwaysCacheMissIfCacheDisabled() throws Exception {
          String key1 = "Key1";
          String key2 = "Key2";
          underTest.get(key1);
          underTest.get(key1);
          underTest.get(key2);
          underTest.get(key2);
          LOG.info(underTest.stats().toString());
          Assert.assertThat(underTest.stats().missCount(), is(equalTo(4L)));
      }
  }
  </code></pre>
  
  <p>That is, turning off the cache always results in a cache miss. </p>
  
  <p>The test fails, though. Is my interpretation incorrect?</p>