FileHashingService
interface FileHashingService (View source)
Utility for computing and comparing unique file hash. All $fs
parameters can either be:
- an
AssetStore
constant VISIBILITY constant or - an actual
Filesystem
object.
Methods
Compute the hash of the provided file
Determined if we have an hash for the provided key and return the hash if present
Move the specified hash value to a different cached key.
Details
string
computeFromStream(resource $stream)
Compute the Hash value of the provided stream.
string
computeFromFile(string $fileID, Filesystem|string $fs)
Compute the hash of the provided file
bool
compare($hashOne, $hashTwo)
Compare 2 full or partial hashes.
bool
isCached()
Whatever computed values should be cached
void
enableCache()
Enable caching of computed hash.
void
disableCache()
Disable caching of computed hash.
void
invalidate($fileID, $fs)
Invlaidate the cache for a specific key.
false|string
get(string $fileID, Filesystem|string $fs)
Determined if we have an hash for the provided key and return the hash if present
void
set($fileID, $fs, $hash)
Explicitely set the cached hash for the provided key.
void
move(string $fromFileID, Filesystem|string $fromFs, string $toFileID, Filesystem|string $toFs = false)
Move the specified hash value to a different cached key.