How to clear cache after updating data in the SQL database
I had to replace some string in all the RTE content of the whole website.
My first thought was to do this with a SQL query:
UPDATE pd set pd.dataNtext = REPLACE(CONVERT(VARCHAR(MAX), pd.dataNText),'someString','someOtherString')
FROM cmsPropertyData pd join cmsDocument doc on pd.versionId = doc.versionId where
dataNtext LIKE '%someString%' AND doc.newest = 1
The script worked and in /umbraco the data is all good. But when I look at the website the old data is still there. I cleared the cache and recycled the app pool but non of that worked. The only thing that seems to update the cache is republish the node.
Is there another way to update this? I don't like republishing the whole website, there are quite a few nodes.
EDIT:
I don't know exactly how the Umbraco backend works but my guess is that the old data is still in the cmsContentXml table. This table get's updated during a publish.
You will most likely have to republish the pages or the site. From my understanding, the cache is local in Umbraco with a new publish and that is how it is updated.
Another option you could try is to "touch" the web.config. Add a space someplace after a closing tag, that typically has worked for me in the past when cache has been an issue. with .Net projects.
Touching the web.config will result in an app pool recycle which I already tried. It's not in memory cache which leads to this problem. I don't know exactly how the Umbraco backend works but my guess is that the old data is still in the cmsContentXml table. This table get's updated during a publish.
Republishing the website is an option which will certainly work but i'm searching for a better way to do this. Republishing all nodes is very expensive and time consuming.
Hmm, I would have thought the application pool trick would have pulled a fresh batch to re-index. You could try Dave's solution below or the only other thing I can think of is to Rebuild the Examine Indexer. In Developer there is the tab for 'Examine Management'. This re-indexes the node, but again, if the cmsContentXml table is not updated, it may just re-index the current data. It is worth a shot. Just rebuild everything in the Indexers.
How to clear cache after updating data in the SQL database
I had to replace some string in all the RTE content of the whole website. My first thought was to do this with a SQL query:
The script worked and in /umbraco the data is all good. But when I look at the website the old data is still there. I cleared the cache and recycled the app pool but non of that worked. The only thing that seems to update the cache is republish the node.
Is there another way to update this? I don't like republishing the whole website, there are quite a few nodes.
EDIT:
I don't know exactly how the Umbraco backend works but my guess is that the old data is still in the cmsContentXml table. This table get's updated during a publish.
Hi @rboogaerts,
You will most likely have to republish the pages or the site. From my understanding, the cache is local in Umbraco with a new publish and that is how it is updated.
Another option you could try is to "touch" the web.config. Add a space someplace after a closing tag, that typically has worked for me in the past when cache has been an issue. with .Net projects.
Touching the web.config will result in an app pool recycle which I already tried. It's not in memory cache which leads to this problem. I don't know exactly how the Umbraco backend works but my guess is that the old data is still in the cmsContentXml table. This table get's updated during a publish.
Republishing the website is an option which will certainly work but i'm searching for a better way to do this. Republishing all nodes is very expensive and time consuming.
Thanks for your input.
Hmm, I would have thought the application pool trick would have pulled a fresh batch to re-index. You could try Dave's solution below or the only other thing I can think of is to Rebuild the Examine Indexer. In Developer there is the tab for 'Examine Management'. This re-indexes the node, but again, if the cmsContentXml table is not updated, it may just re-index the current data. It is worth a shot. Just rebuild everything in the Indexers.
Dave mentioned in this post, https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/76782-refresh-xml-of-content-node-and-update-cache
You could try to use the Content Service if the Examine rebuilding doesn't work.
I solved the problem by using the contentService to only publish the changed nodes.
Thanks!
Hi,
Did you have a look at this package : https://our.umbraco.org/projects/backoffice-extensions/find-and-replace/
This let's you do this without running any db scripts.
Dave
Hi Dave
For this specific problem the package wouldn't solve it. It looks like an awesome package tho.
I solved the problem by using the contentService to only publish the changed nodes.
Thank you for your input.
I solved the problem by only publishing the changed nodes in code using the contentService.
is working on a reply...