class Hashster
{

   /**
    * Retrieves a remote resource, such as a file,
    * calculates the sha-256 hash, and returns the hash.
    * 
    * @param string $uri resource URI
    * @param int $ttl time until expiration in minutes
    * @return String resource hash
    */
   public function getRemoteResourceHash(
      $uri = null, $ttl = 5
   ) {

      $contents = '';

      // does the cache have the resource
      if (Cache::has($uri)) {
         // get the data from the cache
         $contents = Cache::get($uri);
      } else {
         // read in file's / URLs contents
         $contents = hash_file('sha256', $uri);

         // store data in cache
         Cache::add($uri, $contents, $ttl);
      }

      return $contents;
   }
}