Exclude a specific contenttype from cache (umbraco.config)
Hi there,
I'm having some trouble with a site. It has a lot of nodes.
Every sent contactform gets also saved as a contentitem (for backup/history)
Now, the umbraco.config file is almost 20MB, and most of it's contents are these sent contact-forms.
They are only available in the backend, so I want to exclude them from the cache. Is there a easy way to exclude a specific contenttype from getting cached? So my umbraco.config will get a normal filesize again?
What I would suggest for now is simply unpublishing the parent node of these items which will remove them from the cache. This may have implications, however, if you are retrieving these items from the cache anywhere in the application (using the UmbracoHelper for instance).
When the form is submitted I'm guessing it's creating an IContent and calling SaveAndPublish. I'm not sure what happens when you call SaveAndPublish if the parent node is unpublished. I would guess that the publish has no effect, but it's probably worth changing this to just Save anyway.
Have a look at using PetaPoco (shipped with Umbraco) to save these to a custom database table. You could then use either Fluidity or UI-O-Matic to make the data available in the backoffice.
Exclude a specific contenttype from cache (umbraco.config)
Hi there,
I'm having some trouble with a site. It has a lot of nodes. Every sent contactform gets also saved as a contentitem (for backup/history)
Now, the umbraco.config file is almost 20MB, and most of it's contents are these sent contact-forms.
They are only available in the backend, so I want to exclude them from the cache. Is there a easy way to exclude a specific contenttype from getting cached? So my umbraco.config will get a normal filesize again?
Hi Jeroen,
Currently there isn't a way to do this. It's been discussed but nothing has made it into the core:
What I would suggest for now is simply unpublishing the parent node of these items which will remove them from the cache. This may have implications, however, if you are retrieving these items from the cache anywhere in the application (using the
UmbracoHelper
for instance).When the form is submitted I'm guessing it's creating an
IContent
and callingSaveAndPublish
. I'm not sure what happens when you callSaveAndPublish
if the parent node is unpublished. I would guess that the publish has no effect, but it's probably worth changing this to justSave
anyway.Longer term you probably want to change the implementation. Using Umbraco content items for volatile data is not recommended: https://our.umbraco.org/documentation/reference/Common-Pitfalls/#using-umbraco-content-items-for-volatile-data
Have a look at using PetaPoco (shipped with Umbraco) to save these to a custom database table. You could then use either Fluidity or UI-O-Matic to make the data available in the backoffice.
Thank you for your quick answer.
I haven't thought about unpublishing the content. It's never used on the front-end, so only the SaveAndPublish() will need possible adjustment.
I will have a look at PetaPoco, thank you.
is working on a reply...