Comments (5)
No problems, ServiceClientBase with virtual method attached.
Yeah ICacheClient was nice helped us seamlessly migrate to a different caching
providers pretty easily as well.
If you're doing server-side caching you should check out
'RequestContext.ToOptimizedResultUsingCache' as seen in:
http://code.google.com/p/servicestack/source/browse/trunk/ServiceStack.Examples/
ServiceStack.Examples.ServiceInterface/GetNorthwindCustomerOrdersCachedService.c
s
Basically writes the most optimal result (e.g. gzipped xml/json or serialized
xml/json) which whenever a cache exists avoids any serialization.
If your doing caching using the ICacheClient you may want to check out
CacheManager:
http://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Co
mmon/ServiceStack.CacheAccess.Providers/CacheManager.cs
As it has a nice API that lets you do stuff like:
return cacheManager.Resolve(cacheKey, () => {
return base.Send<T>(request);
});
which will send and cache the result and return the cache result from then on.
- Demis
Original comment by [email protected]
on 25 Aug 2010 at 8:29
Attachments:
from servicestack.
It's getting a bit boring, but thanks once again for etc...
Nice tip about the ToOptimizedResultUsingCache. That's really an elegant
solution!
The more time I spend with ServiceStack, the more I'm fond of it's hidden gems,
and the more I realize how difficult it is to convey that to others. Anyway,
I'm glad you chose to make this an Open Source project. Thanks again.
Original comment by [email protected]
on 25 Aug 2010 at 8:48
from servicestack.
Yeah no worries I glad you find it useful as well.
Send me a link if you ever get anything deployed on the Internet somewhere, its
would be good to see what other people are doing with it.
Cheers,
Demis
Original comment by [email protected]
on 25 Aug 2010 at 8:55
- Changed state: Fixed
from servicestack.
There seems to be one issues when trying to combine the
ServiceClientBase.SendRequest<T> with ICacheManager.Resolve<T>
The second one has a class restriction on the template parameter (and I think I
know why).
I'm not yet sure how to solve that, but I was thinking along the lines of how
you handle the QueryStringSerializer with statically initialized callbacks (you
might want to patent that). Any thoughts about this?
Original comment by [email protected]
on 25 Aug 2010 at 9:22
from servicestack.
Yeah that's the problem with cascading generic restrictions not mixing very
well. Ultimately it's valid restriction as both methods should only be taking
DTO's or POCO's anyway.
A quick solution for you would be to add another method to your subclass with
this restriction which will then happily call your base method that doesn't
have one:
public TResponse CacheSend<TResponse>(object request)
where TResponse : class
{
return base.Send<TResponse>(request);
}
Although its appropriate to include this restriction on IServiceClient (which
will also fix this), it would likely be invasive and introduce compile-errors
in other parts of ServiceStack including tests so will need to do an Audit of
code before I can do this.
Original comment by [email protected]
on 25 Aug 2010 at 9:39
from servicestack.
Related Issues (20)
- Serializing byte[] cannot be Deserialized.
- CreateTransaction failing HOT 1
- TypeInitializationException when a class have a property that return an XElement value
- TypeInitializationException when deserialiaze a string to a class that have a static property
- Priority of Web Sockets HOT 1
- How to Store values in session
- Implement Forms Authentication Using ServiceStack HOT 1
- OrmPostgreSQL HOT 1
- Supporting for redis ZCOUNT command
- WCF helper implementation
- Null reference exception on call to GetAll HOT 2
- Broken link on Project Home HOT 2
- DeSerialising dictionary with type Dictionary<Tuple<string,string>,double>>() does not work
- Wrong Encoding
- ServiceStack.Redis reading large files from Redis server
- ServiceStack.Redis.RedisResponseException
- Db number is fogotten when using pooled clients.
- SOAP request and response wrappers
- Tutorial references ServiceStackHttpHandlerFactory which isn't included in ServiceStack.dll
- Future roadmap suggestion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from servicestack.