<commit_before>package org.realityforge.replicant.client.transport.gwt;

import com.google.gwt.storage.client.Storage;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.replicant.client.transport.CacheEntry;
import org.realityforge.replicant.client.transport.CacheService;

/**
 * An implementation of the CacheService that uses LocalStorage or SessionStorage if available.
 */
public class LocalCacheService
  implements CacheService
{
  private static final Logger LOG = Logger.getLogger( LocalCacheService.class.getName() );

  private static final String ETAG_SUFFIX = "_ETAG_";
  private boolean _loggedNoLocalStorage;

  /**
   * {@inheritDoc}
   */
  @Override
  public CacheEntry lookup( final String key )
  {
    final Storage storage = getStorage();
    if ( null == storage )
    {
      return null;
    }
    else
    {
      final String eTag = storage.getItem( key + ETAG_SUFFIX );
      final String content = storage.getItem( key );
      return new CacheEntry( key, eTag, content );
    }
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean store( final String key, final String eTag, final String content )
  {<commit_msg>Add correct nullability annotations to LocalCacheService<commit_after>package org.realityforge.replicant.client.transport.gwt;

import com.google.gwt.storage.client.Storage;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.replicant.client.transport.CacheEntry;
import org.realityforge.replicant.client.transport.CacheService;

/**
 * An implementation of the CacheService that uses LocalStorage or SessionStorage if available.
 */
public class LocalCacheService
  implements CacheService
{
  private static final Logger LOG = Logger.getLogger( LocalCacheService.class.getName() );

  private static final String ETAG_SUFFIX = "_ETAG_";
  private boolean _loggedNoLocalStorage;

  /**
   * {@inheritDoc}
   */
  @Override
  public CacheEntry lookup( @Nonnull final String key )
  {
    final Storage storage = getStorage();
    if ( null == storage )
    {
      return null;
    }
    else
    {
      final String eTag = storage.getItem( key + ETAG_SUFFIX );
      final String content = storage.getItem( key );
      return new CacheEntry( key, eTag, content );
    }
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean store( @Nonnull final String key, @Nonnull final String eTag, @Nonnull final String content )
  {
{'fraction_non_alphanumeric': 0.09457900807381776, 'fraction_numerical': 0.0, 'mean_word_length': 3.7655677655677655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '537750', 'n_tokens_mistral': 754, 'n_tokens_neox': 746, 'n_words': 205}