<commit_before><?php
namespace ReverseGeocoderCache;

class CacheFrontEnd
{
  public static $EARTH_RADIUS = 6371000;
  
  
  public function __construct($keySize)
  {
    $this->keySize = $keySize;
  }
  
  public function save($latitude,$longitude,$data)
  {
    
  }
  
  public function load($latitude,$longitude)
  {
    
  }
 
 
  public function getCacheKey($latitude,$longitude)
  {
    $keySizeRadians = $this->getRadiansByDistance($this->keySize);
    
    $latitudeRadians = $this->getRadiansByDegree($latitude);
    $longitudeRadians = $this->getRadiansByDegree($longitude);
    
    $keyLatitude = round($latitudeRadians / $this->getLatitudeKeyLength());
    $keyLongitude = round($longitudeRadians / $this->getLongitudeKeyLength($latitude));
    
    return "key-slot-size-".$this->keySize."-lat-".$keyLatitude."-lng-".$keyLongitude."";
  }
  
  
  protected function getRadiansKeySize()
  {
    return $this->getRadiansByDistance($this->keySize);
  }
  
  protected function getRadiansByDegree($degree)
  {
    return (M_PI/180)*$degree;
  }<commit_msg>first stable<commit_after><?php
namespace ReverseGeocoderCache;

class CacheFrontEnd
{
  public static $EARTH_RADIUS = 6371000;
  
  
  public function __construct($cacheBackend,$keySize,$prefix)
  {
    $this->cacheBackend = $cacheBackend;
    $this->keySize = $keySize;
    $this->prefix = $prefix;
  }
  
  public function set($latitude,$longitude,$data)
  {
    $key = $this->getCacheKey($latitude, $longitude);
    $this->cacheBackend->set($key, $data);
  }
  
  public function get($latitude,$longitude)
  {
    $key = $this->getCacheKey($latitude, $longitude);
    return $this->cacheBackend->get($key);
  }
 
  public function exists($latitude,$longitude)
  {
    $key = $this->getCacheKey($latitude, $longitude);
    return $this->cacheBackend->get($key);
  }
 
  protected function getCacheKey($latitude,$longitude)
  {
    $keySizeRadians = $this->getRadiansByDistance($this->keySize);
    
    $latitudeRadians = $this->getRadiansByDegree($latitude);
    $longitudeRadians = $this->getRadiansByDegree($longitude);
    
    $keyLatitude = round($latitudeRadians / $this->getLatitudeKeyLength());
    $keyLongitude = round($longitudeRadians / $this->getLongitudeKeyLength($latitude));
    
    return $this->prefix."key-slot-size-".$this->keySize."-lat-".$keyLatitude."-lng-".$keyLongitude."";
  }
  
  
  protected function getRadiansKeySize()
  {
    return $this->getRadiansByDistance($this->keySize);
  }
  
  protected function getRadiansByDegree($degree)
  {
    return (M_PI/180)*$degree;
  }
{'fraction_non_alphanumeric': 0.1502329192546584, 'fraction_numerical': 0.007763975155279503, 'mean_word_length': 4.052941176470588, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '2059546', 'n_tokens_mistral': 909, 'n_tokens_neox': 886, 'n_words': 117}