6

All over the Internet you can find instructions on how to clear the file cache on your SharePoint box. It seems to be the same set of steps copy and pasted, without much understanding or explanation. For instance they almost always contain the following:

"Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1"

This sentence makes no sense. Not being 1 is totally different from containing its previous value. And yet everyone seems to agree on this step.

Another thing everyone seems to agree on is "DO NOT DELETE THIS FILE", always in all caps. And the recommendation is always given that this file should be "backed up". But this file just contains a number. Why not just say "Copy the number out in case something goes wrong"? Is there some process that points to the actual inode of the file rather than the file's path? This is a cache, so surely it can be cleared safely and rebuilt from scratch? Why would you ever need to "back up" a cache?

Furthermore, I don't understand why any caching system would need a file that just contains some number. What does it represent? Is it a timestamp of the last time the cache was updated? Is it just a count of objects, incremented every time an object is added to the cache? Is it random? What does a value of "1" represent?

So my main question is, what can actually go wrong by deleting the cache.ini file? Is it serious or can it be recovered from? Why would you ever use the backup you created of the cache.ini file?

2 Answers 2

2

Cache.ini must exist, and it must have a numeral value contained within it (1 or higher). The cache.ini file closely mirrors the number contained within the Configuration database’s LastUpdate table. This table contains two columns, a Value column and a Version column. The Version column increments on a regular basis, and the cache.ini updates from the Version value. To accomplish this, there is a local Timer Job on each server with the internal name of “job-config-refresh”. This timer job runs on a 15 second interval. The timer job itself validates that the cache.ini has not been invalidated, then runs the stored procedure within the Configuration database, proc_getNewObjects. If the value in the cache.ini file is less than the value contained in the LastUpdate table, a SELECT statement is run against the Objects table where the value within the LastUpdate table is less than the value of the Version column in the Objects table; it also tombstones objects in the Tombstone table.

Read complete blog here

4
  • 1
    This would mean that backing up the cache.ini file is completely pointless, correct?
    – Nacht
    Commented Nov 3, 2016 at 12:06
  • 1
    You still haven't answered my main question. What can go wrong?
    – Nacht
    Commented Nov 3, 2016 at 12:07
  • 1
    If config cache is out of sync you get all kind of error... unexpected error, file not found etc
    – Waqas Sarwar MVP
    Commented Nov 3, 2016 at 12:50
  • 1
    Ok. You can then just fix this by adding the file back right?
    – Nacht
    Commented Nov 15, 2016 at 4:45
2

Waqas' answer and linked blog post helps explain what is going on with the File Cache, but there are a few questions left unanswered. Here is a summary.

What is the file cache?

The file cache contains xml files which represent objects in the Config database (often named SP_Config). This helps each WFE server to operate faster so that it does not have to keep requesting this data from the Config database.

What populates the file cache?

There is a timer job that is configured to run every 15 seconds by default called job-config-refresh. This populates the SharePoint file cache.

What is the cache.ini file?

The cache.ini file, in the file cache, contains a value, from the LastUpdate table in the Config database, from the Version column. This value is incremented in the Config database as objects in it are updated.

If you set this file to have a value of "1", after the file cache refresh job has run, this file should contain the same value that it contained before, unless some objects in the Config database were updated while you were deleting the file cache. You don't have to ensure it contains the same value as before - you simply have to ensure it is updated at all.

What can go wrong if this file does not exist?

There are many errors that can crop up across the system, for example "File not found" errors.

-more info required here

Why this "back up" talk?

You don't need to "back up" anything. This is superstitious nonsense. Simply delete all the xml files, and the cache.ini file, and create a new cache.ini file with a value of "1".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.