ProxyFactory.Cache API

0 views
Skip to first unread message

Brian Chavez

unread,
May 10, 2008, 7:18:12 PM5/10/08
to linfufr...@googlegroups.com

Hi Philip,

 

I'm working with DynamicProxy, ProxyFactory cache. I noticed I could use the following method signature in my code to create a proxy:

 

ProxyFactory.CreateProxy<T>( someInterceptor )

 

Which is very nice.. However, notice, since baseInterface is a params parameter, I don't need to pass in "null" or some fake array to satisfy the baseInterface parameter.  The code ultimately looks cleaner from the callers perspective.

 

However, now if we take a look at ProxyFactory.Cache/IProxyCache, we find, that in order to store a proxy in ProxyFactory.Cache we have a signature of the following:

 

ProxyFactory.Cache.StoreProxyType(Type result, Type baseType, Type[] baseInterfaces);

 

Only, except, baseInterfaces here is not params, so callers are forced to satisfy baseInterfaces with either passing null or "new Type[0]".

 

------------------------

 

It would be nice if the baseInterfaces were params in IProxyCache too.  This way, the API would be consistent with the rest of the DynamicProxy API.  However, I'm not fully aware of the side effects this might cause, so ultimately, it's only a suggestion.

 

Also, I noticed, IProxyCache.Contains()/GetProxyType() have "Type[] interfaces" as a parameter name not "Type[] baseInterfaces".  I sorta got confused and had to look at the source code to figure out if they were the same or not.  I know it's a cherry picking issue, but it's nice to be consistent with the rest of the API.

 

Any thoughts?

 

Thanks,

Brian

 


----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com

 

Philip Laureano

unread,
May 11, 2008, 11:22:47 AM5/11/08
to linfufr...@googlegroups.com
Hi Brian,

Since the ProxyCache API is internal to LinFu.DynamicProxy, applying the changes that you mentioned won't break any part of the LinFu framework. If you check the SVN, you'll notice that LinFu.DynamicProxy has been patched to reflect those requested changes. I hope that helps. :)

Oh, and just out of curiousity, what do you plan on doing with the ProxyCache API? It's one of the more esoteric parts of LinFu, and I can't fathom why anyone would want to extend it.

Brian Chavez

unread,
May 12, 2008, 12:59:37 PM5/12/08
to linfufr...@googlegroups.com

Hi Philip,

 

It was partly due to a misunderstanding on my part on how caching worked in LinFu.DynamicProxy.ProxyFactory.  I was trying to improve proxy building performance in an ASP.NET application.  Originally, I was trying to cache the types in HttpApplicaitonState using a custom caching technique.

 

After taking a better look at the source code, I noticed that I could simply cache 1 ProxyFactory in HttpApplicaitonState without having to roll my own proxy cache.  I didn't know that ProxyFactory had its own caching strategy (which is why I was trying to implement caching).  Sorry!  But at least the API is a little cleaner.  Also, I'm going to work with some distributed caching soon, so this little experiment might come in helpful in the future.

 

-Brian

 

 


----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com

 

Philip Laureano

unread,
May 12, 2008, 8:41:14 PM5/12/08
to linfufr...@googlegroups.com
Hi Brian,

I've never really tried a distributed caching solution for LinFu, but I'd definitely be interested in seeing the results. That reminds me--Brian, if you don't mind me asking you, how are you using LinFu in your production environment? I often get a lot of feedback about how LinFu is easy to use, but I have yet to hear how it would scale on an enterprise level.

Brian Chavez

unread,
May 13, 2008, 9:01:30 PM5/13/08
to linfufr...@googlegroups.com

Hi Philip,

 

Currently, I'm working with indeXus Shared Cache:

 

http://www.codeplex.com/SharedCache

 

which has some support for Distributed and Replicated caching.  We're not in production yet; in fact, we're still very much in development, but the iteration I was working on was performance related.

 

I'm using LinFu to help keep our application code base maintainable and so far, it's working out really well.  I haven't had a problem with LinFu.DynamicProxy and seems to be pretty fast as-is.  We've been working on our project for about a year now and I can't exactly let the cat out of the bag yet until we release (which should be in a few more months).

 

Once released, I have plans on a blog post and article on CodeProject with the source to the helping framework we built on top of LinFu that we're using for our larger project.  It's really cool, I can't wait to share what we built! :P

 

I won't have any real-world performance numbers until it's been released and in the wild.  But I'll post them once we get there.

Philip Laureano

unread,
May 14, 2008, 12:48:54 AM5/14/08
to linfufr...@googlegroups.com
Awesome. I can't wait to see it. Thanks Brian!
Reply all
Reply to author
Forward
0 new messages