Aging Data Structure in C#

Posted by thelsdj on Stack Overflow See other posts from Stack Overflow or by thelsdj
Published on 2008-08-18T21:44:07Z Indexed on 2010/04/23 15:33 UTC
Read the original article Hit count: 316

Filed under:
|
|
|

I want a data structure that will allow querying how many items in last X minutes. An item may just be a simple identifier or a more complex data structure, preferably the timestamp of the item will be in the item, rather than stored outside (as a hash or similar, wouldn't want to have problems with multiple items having same timestamp).

So far it seems that with LINQ I could easily filter items with timestamp greater than a given time and aggregate a count. Though I'm hesitant to try to work .NET 3.5 specific stuff into my production environment yet. Are there any other suggestions for a similar data structure?

The other part that I'm interested in is aging old data out, If I'm only going to be asking for counts of items less than 6 hours ago I would like anything older than that to be removed from my data structure because this may be a long-running program.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ