Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to remove a compiled type from the cache

Reply
Thread Tools

How to remove a compiled type from the cache

 
 
Marvin Landman
Guest
Posts: n/a
 
      10-25-2009
Hi,

I have implemented a custom VirtualPathProvider that generates source
code. The source code is changing periodically but BuildManager is
caching the results.

How could I force a recompilation or invalidate the cache for my
generated code?

Thanks.

Regards,
Marvin
 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      10-26-2009
Hi Marvin,

>I have implemented a custom VirtualPathProvider that generates source
>code. The source code is changing periodically but BuildManager is
>caching the results.


>How could I force a recompilation or invalidate the cache for my
>generated code?


In your custom VirtualPathProvider class you can override GetCacheKey and
return something random to do so:

public override string GetCacheKey(string virtualPath)
{
return Guid.NewGuid().ToString();
}

Please have a test and let me know if it works.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      10-27-2009
Hi Marvin,

>I have implemented a custom VirtualPathProvider that generates source
>code. The source code is changing periodically but BuildManager is
>caching the results.


>How could I force a recompilation or invalidate the cache for my
>generated code?


Sorry, by overriding GetCacheKey and return something random we may
increase memory infinitely. Another approach you can try is to override
GetCacheDependency method:

public override System.Web.Caching.CacheDependency
GetCacheDependency(string virtualPath, System.Collections.IEnumerable
virtualPathDependencies, DateTime utcStart)
{
return new CacheDependency(@"file path"); //By changing the content
of the file you can update cached data
// You can also use SqlCacheDependency or your custom
CacheDependency to meet your needs.
}

Can you test it to see if it can solve this issue?

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



 
Reply With Quote
 
Marvin Landman
Guest
Posts: n/a
 
      10-28-2009
> Sorry, by overriding GetCacheKey and return something random we may
> increase memory infinitely. Another approach you can try is to override
> GetCacheDependency method:
>
> public override System.Web.Caching.CacheDependency
> GetCacheDependency(string virtualPath, System.Collections.IEnumerable
> virtualPathDependencies, DateTime utcStart)
> {
> return new CacheDependency(@"file path"); //By changing the content
> of the file you can update cached data
> // You can also use SqlCacheDependency or your custom
> CacheDependency to meet your needs.
> }
>
> Can you test it to see if it can solve this issue?


Thank you very much this perfectly fits my needs.

Marvin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
If I create a page, then it's compiled upon first request, where cani find the compiled code?? lander ASP .Net 5 03-05-2008 04:34 PM
g++ compiled C++ code called from gcc compiled C code Klaus Schneider C++ 1 12-02-2004 01:44 PM
Page.Cache vs HttpContext.Current.Cache DesignerX ASP .Net 5 01-20-2004 10:55 PM
Cache::Cache Stale Segments Jeff Nokes Perl 0 09-30-2003 04:34 PM



Advertisments