AtomEventsInMemory is one of AtomEventStore's built-in storage options. It uses in-memory strings to 'store' Atom Feed documents.
Obviously, using in-memory strings isn't a persistent storage mechanism, so when an AtomEventsInMemory
instance goes out of scope, all events 'stored' in it are lost. Thus, this implementation is mostly useful for unit testing and prototyping.
Apart from lower latency due to the absence of I/O, AtomEventsInMemory has similar behaviour as other implementations of IAtomEventStorage, since AtomEventStore uses the same serialization and deserialization mechanism as it would for other storage implementations. This makes it well-suited for GOOS-style automated tests.
Most other IAtomEventStorage implementations are stateless. AtomEventsInMemory, on the other hand, maintains state in memory (since all it does is to save events in memory). Therefore, its methods are designed to be thread-safe.
Notice that AtomEventsInMemory
implements IDisposable
, so when an instance is no longer in use, you should remember to dispose of it.
In order to use the AtomEventsInMemory
class, simply create an instance of it:
using (var storage = new AtomEventsInMemory())
Notice that in this example, the storage
variable is created in a using
statement, in order to ensure that it's properly disposed of when it goes out of scope.
Since AtomEventsInMemory
implements IAtomEventStorage, it can be passed to writers and readers of event streams.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4