top | item 27301584

(no title)

corroclaro | 4 years ago

How do you envision the static variables thing? I've seen the cache thing myself in real life but not the other.

discuss

order

AtNightWeCode|4 years ago

In C# for instance. If you mark a field static it is the same for all instances of a class (if you don't mark the code as thread static). So if you have static User field that changes on logon it will change for everyone. I have seen this but typically more complicated versions of it.

adflux|4 years ago

Store user in static variable during processing data, then forget to clear the variable when you are done, so for the next request it still has access to the old data?

chopin|4 years ago

These can act like a cache across all instances. For exactly this reason I use them only as final (constant) variables and very, very rarely mutable.