ASP.NET Cache: Which one is faster?
-
ASP.NET
Cache
object or UsingStatic
Variables. If static variables are faster then why should we useCache
object? Is it only for setting expiration? Is there any different betweenApplication
object andStatic
variables? Please advise. -
ASP.NET
Cache
object or UsingStatic
Variables. If static variables are faster then why should we useCache
object? Is it only for setting expiration? Is there any different betweenApplication
object andStatic
variables? Please advise.Shubhabrata Mohanty wrote:
ASP.NET Cache object or Using Static Variables
The Static variables should be faster IMO.
Shubhabrata Mohanty wrote:
If static variables are faster then why should we use Cache object? Is it only for setting expiration?
Yes, the Cache supports to set the expire time or dependency for the item saved in the Cache.
Shubhabrata Mohanty wrote:
Is there any different between Application object and Static variables?
Again, the static variables are faster. For more information, you can see Improving ASP.NET Performance[^]