Hi,
is there a way to clear the cache of a Kentico website via the API from a project different from the CMS one?
I've followed
this guide and I can call the APIs, but they appear to do nothing.
I've tried clearing the cache via CMS.GlobalHelper.CacheHelper.ClearCache (or ClearFullPageCache and ClearPartialCache) and via the following method (found somewhere on the forums):
IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
while (CacheEnum.MoveNext())
{
string key = CacheEnum.Key.ToString();
Cache.Remove(key);
}
The code executes ok, but it doesn't do anything.
If I create a WebPart (e.g. a button that executes the above code) and place it on the actual website it works ok.
We use Kentico v5.5.3926 on both servers.
Let me describe my situation:
We have two websites, one internal that is used for previewing the content to be published (and to lessen the load on the server when publishing from our editorial system, but that's another story altogether :)) and one external which is visible to the users.
Our editors publish content on the internal website, check it out and when they are satisfied they replicate it to the external server.
We use SQL replication and RoboCopy (for the attachments which are stored in the filesystem) because it's so much faster than Kentico's content staging (replicating some 40 articles takes ~1 minute via SQL and ~30-45 minutes via Kentico's content staging).
The new content eventually appears on the external website (when the old content expires from the cache, more or less), the problem is with page templates; they are in the database, however Kentico doesn't load them unless the cache is cleared.
I have a website that our editors use to start the SQL replication; I had the idea that I could use the API to clear the cache after the replication is complete.