.NET cache providers that support streaming?
Does anyone know any cache pro开发者_如何学编程viders for .NET that support streaming data directly in/out by key, rather than serializing/deserializing objects?
I was rather hoping AppFabric (Velocity) would, but it only appears to deal with objects like the built-in ASP.NET cache.
NCache Enterprise is the only .NET cache provider I can find that supports streaming:
// Insert
using (var cacheStream = cache.GetCacheStream("mykey", StreamMode.Write))
cacheStream.Write(...);
// Retrieve
using (var cacheStream = cache.GetCacheStream("mykey", StreamMode.Read))
cacheStream.Read(...);
You could easily implement this yourself in your WCF service (I assumed that is what you wanted to do.)
Either have the clients poll for new data periodically, or implement the callback pattern to send new data to the subscribed clients as it arrives, depending on what keys they are subscribed too.
Otherwise you could have each client connect to your service via a socket, and repeat the data you receive from the source to these sockets, plus keep the data yourself so if a new client connects, you can send the whole lot of data to them, in their easy to digest chunks.
Plus you can design the application to not care what data it is streaming, just that it is streaming a blob, and use it for other applications in the future.
Edit: You could always use the streaming transport build into WCF to stream to your users, but would still not solve your problem retriving data from the source unless they were to implement it too.
精彩评论