Cache Critical Data
Users are likely to want to revisit some of the documents and data that they have recently accessed. When they try to review information from a disconnected network location, they might want access to cached copies of their recently accessed documents. Many mobile PCs offer generous disk space. You can provide offline access to recently viewed documents or data.
Windows Vista, through its offline folders feature, allows users to cache the contents of networked folders. Offline folders are implemented by using a technology called client-side caching (CSC).
Client-side caching in Windows Vista
Through CSC, network files can be cached through a number of different approaches. You can choose to manage caching in three ways:
- Set administrative options on the server.
- Instruct your users to set up offline folders.
- Implement programmatic caching in your application.
Regardless of the method, after a file is cached, CSC manages the synchronization and update of the file between the client computer and the server.
Three modes of caching
When specifying caching options for a server, an administrator can designate one of three caching modes for a folder or for individual files.
Any designated file or folder is automatically cached on the computer from which it is accessed. Files that are cached in this way are subject to removal from the cache as new files come in.
The user can manually designate files or folders to be cached. In this mode of caching, called "pinning," the files are always available locally and are not removed from the cache until they are unpinned.
Files cannot be cached locally if, for example, local storage of files presents a security issue. Attempts to pin such a file result in an error notification or error code.
In addition, an application can use CSC programming interfaces to implement its own caching behavior.
Considering what to cache
Because the application designer is in a unique position to analyze user needs and determine what types of information are likely to be needed when users work offline, consider whether to implement automatic caching on the client computer through your application. Windows Vista introduces an expanded programming model for CSC that allows application developers to control offline files programmatically. For example, your application can enable caching for specific files or folders, specify the synchronization frequency for the cache, retrieve files from the cache, and receive notifications when updates occur to cached files.
With some simple instrumentation, your application can track the files and information that users open, view, and edit, and thus make some reasonable predictions about which files or information will be needed later. For example, files that appear on a most-recently used (MRU) list within the previous two weeks might be likely candidates for offline caching. To manage the size of the cache, you can implement a scheme whereby cached documents that have not been accessed recently can be expired and removed from the cache.
Designers of data-rich applications, such as database clients, can examine how data records tend to be consumed during a typical work week. For example, a customer management database might store client records, employee contact schedules, and travel itineraries. With some careful analysis, you can make reasonable predictions about what data records will be needed in the near future, and cache those records locally.
If it's important that users remain aware of how current the offline data is, you can design an unobtrusive convention to indicate the age and status of files or records.
Programmatic caching by using CSC
An application can use the CSC programming interfaces to pin a file or folder. Because pinning caches the file until the pin is explicitly removed, your application should build in cache management logic to manage the application's use of disk space on mobile PCs.
You can subscribe to notifications about updates to cached files, and if appropriate, notify the user as updates occur. For more information about when to use notifications, see Notifications.