<commit_before><?php

namespace iFixit\Matryoshka;

use iFixit\Matryoshka;

class Scope extends KeyChange {
   private $backend;
   private $scopeName;
   private $scopePrefix;

   public function __construct(Backend $backend, $scopeName) {
      parent::__construct($backend);

      $this->scopeName = $scopeName;
      $this->backend = $backend;
   }

   public function changeKey($key) {
      $prefix = $this->getScopePrefix();

      return "{$prefix}$key";
   }

   public function getScopePrefix($reset = false) {
      if ($this->scopePrefix === null || $reset) {
         $this->scopePrefix = $this->backend->getAndSet($this->getScopeKey(),
          function() {
            return substr(md5(microtime()), 0, 4);
         }, 0, $reset);
      }

      return $this->scopePrefix;
   }

   public function getScopeName() {
      return $this->scopeName;
   }

   /**
    * Deletes the scope which effectively invalidates all cache entries under<commit_msg>Scope: Increase scope prefix length<commit_after><?php

namespace iFixit\Matryoshka;

use iFixit\Matryoshka;

class Scope extends KeyChange {
   private $backend;
   private $scopeName;
   private $scopePrefix;

   public function __construct(Backend $backend, $scopeName) {
      parent::__construct($backend);

      $this->scopeName = $scopeName;
      $this->backend = $backend;
   }

   public function changeKey($key) {
      $prefix = $this->getScopePrefix();

      return "{$prefix}$key";
   }

   public function getScopePrefix($reset = false) {
      if ($this->scopePrefix === null || $reset) {
         $this->scopePrefix = $this->backend->getAndSet($this->getScopeKey(),
          function() {
            return substr(md5(microtime()), 0, 8);
         }, 0, $reset);
      }

      return $this->scopePrefix;
   }

   public function getScopeName() {
      return $this->scopeName;
   }

   /**
    * Deletes the scope which effectively invalidates all cache entries under
{'fraction_non_alphanumeric': 0.13357215967246674, 'fraction_numerical': 0.0040941658137154556, 'mean_word_length': 2.9494949494949494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '6183272', 'n_tokens_mistral': 591, 'n_tokens_neox': 567, 'n_words': 135}