Closed perosb closed 8 years ago
I'm not sure I'm following here - is this so you can return something like base.GetHash(blah) + timestamp? Couldn't you just implement IHasher and use the built in hasher internally?
I kind of like that approach better because it forces you to implement all methods on the interface with your custom logic - it would be easy to miss one or more and get in an inconsistent state if inheriting/overriding (especially if a new method was added to interface / base class for example).
Right, the idea was to add some timestamp + content before calculating the hash. In certain scenarios things gets cached incorrectly and requires manual invalidation at CDN level.
I'm looking for a better way to force a new, unique hash.
I saw a similar commit that allowed override of the Hash algorithm so thought something to align.
But, yes, an internal could be used too.
Yeah, thats a bit different because it only allows overriding the hash algorithm (the logic surrounding it would remain the same).
The equivalent would be to only override the method taking a stream (because all other logic around it would remain constant). But I assume you need to tweak logic in the other methods to create a timestamp.
There are no plans to add new methods but I'm working on moving off .net 3.5 right now and anything could happen - want to be sure I don't break something on you. So wrapping/delegating will probably be the safe option, since the compiler will tell you if I do :)
Mark as virtual to allow to create custom hasher which can add for example a timestamp or similar to the hash to force invalidation.