Silverlight assembly Cache Smart Settings optimize user experience

Source: Internet
Author: User
Keywords caching such as figure user experience if
Tags browser cache cached caching click client compile default

The assembly cache in Silverlight can place separate assemblies outside the XAP package and can slow down the client's browser, which reduces the time it will take to download the XAP package when the program starts. Silverlight does not open the assembly cache by default, so it needs to be started on its own.

Right-click to open the properties of the project and hook up the smaller xap size option by using the threading cache, as shown in figure:

Compile the project before you select this item look at the DLL in XAP, as shown in figure:

Recompile the project, choose to display all the files, and then open the Debug directory, and you will see that each cached assembly has its own ZIP file package. For example, if you use System.Windows.Controls.dll, you will see a System.Windows.Controls.zip file, as shown in figure:

This zip package contains System.Windows.Controls.dll, as shown in figure:

The original XAP package will not exist in this DLL, as shown in figure:

If you are using ASP.net as a test site, Visual Studio will copy the XAP package and all the cached assemblies into the ClientBin directory, as shown in figure:

This is the contents of the ClientBin directory before the cache assembly is used, as shown in figure:

Using the assembly cache does not improve performance when you first open a program, because it still requires XAP packages and other zip content to be downloaded. However, when the user opens the program the second time, because these separate assemblies have been cached to the client without downloading, this increases the user's access speed.

Tips for using:

1. Cached assemblies and browsers have the same cache validity period. If the user manually clears the cache, the assembly cache is also purged.

2. Each time a user runs a program, the program automatically checks to see if the assembly has the latest version. If so, the original cached assembly is downloaded and replaced.

3. If a program downloads and caches the assembly in a browser, other programs that use the cached assembly can also be used.

4. The assembly cache has a greater advantage over assemblies that are bulky, frequently used, and infrequently changed. For those with small size, programs that download less time on startup, try to avoid this approach because it can cause trouble when the program is deployed (multiple zip packages are generated after the assembly cache, and all files need to be placed under the site at deployment time).

5. Custom assemblies do not support assembly caching, such as a class library that you create yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.