forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIFileCacheHash.cs
More file actions
40 lines (37 loc) · 1.28 KB
/
IFileCacheHash.cs
File metadata and controls
40 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
namespace React
{
/// <summary>
/// Handles calculating a hash value for validating a file-based cache.
/// </summary>
public interface IFileCacheHash
{
/// <summary>
/// Calculates a hash for the specified input
/// </summary>
/// <param name="input">Input string</param>
/// <returns>Hash of the input</returns>
string CalculateHash(string input);
/// <summary>
/// Validates that the cache's hash is valid. This is used to ensure the input has not
/// changed, and to invalidate the cache if so.
/// </summary>
/// <param name="cacheContents">Contents retrieved from cache</param>
/// <param name="hash">Hash of the input</param>
/// <returns><c>true</c> if the cache is still valid</returns>
bool ValidateHash(string cacheContents, string hash);
/// <summary>
/// Prepends the hash prefix to the hash
/// </summary>
/// <param name="hash">Hash to prepend prefix to</param>
/// <returns>Hash with prefix</returns>
string AddPrefix(string hash);
}
}