Current location - Quotes Website - Signature design - An article to help you understand the acceleration principle of X-Cache
An article to help you understand the acceleration principle of X-Cache

Recently, Kotori has not only added digital signatures to most of her greening single-file works, but also added this acceleration technology that Kotori calls X-Cache. Now Kotori is here Let’s talk about how X-Cache accelerates

X-Cache does not look like a technology but more like an idea.

First of all, we need to understand that the scenario where X-Cache is applicable is a single-file green version of software/game.

Let’s take a look at what the computer does when it starts up after such a single file is greened.

The single-file green version is actually a special self-extracting file

Take Qinlili’s AIDA64 green version as an example

Step 1 Read the self-extracting file File parameters, we use the compression software to view the self-extraction parameters (the following brackets are the comments manually added by Qin Lili)

Step2 releases a startup interface and runs it

Step3 gradually releases All files

Step4 Start the main program

Step5 The self-extracting process is monitored in the background

Step6 The user ends the software, the self-extracting process clears the cache and exits

Within less than five seconds of closing, the user remembered that there were still unfinished operations

So he had to go through the 6 steps again

Releasing files consumes a lot of hard disk. This is also the fatal problem of slow startup of green version software, especially on HDD.

So since the user may not only use it once, but the files released are the same, why not keep these files first? In this way, the complete release will not be needed the next time you start, and the startup speed will be accelerated

This is the reason why X-Cache was born, so that the file cache can be retained, and at the same time, it can be deleted at will like a normal cache without affecting the use

p>

As we all know, the Windows cache directory %temp% is used to store one-time files that can be deleted after use, and the system will automatically clean them. Especially with the addition of storage awareness in win10, cleaning is more frequent. Moreover, as the cache of greening software, it is not a one-time content, so we must jump out of the cache directory %temp% and find another directory as a file cache

At this time we can consider these folders

1. Program files

The advantage of the program directory is that it will not pollute the user's eyes and is neat. The disadvantage is that it requires administrator permissions to write, and the file directory contains spaces, which is not friendly to self-extracting files, and it is more troublesome to distinguish between x86 and x64 machines. (Imagine a video conversion tool requesting administrator rights and asking you whether it is x86 or x64. Do you think it is normal?)

This directory is suitable for programs that require administrator rights to start and are only adapted to x64. Software

2. AppData

The advantage of the data directory is that you can write whatever you want without worrying about permissions. The disadvantage is that it does not support multiple users, and the self-extracting itself is not friendly to variables such as %username%. If the user uses a Chinese or other non-English user name, some programs will not be able to be opened. In addition, selecting this directory means abandoning XP users. (Although Qin Lili has completely given up on XP users)

3. Create a folder in the root directory of another disk

Many things do this, even some extremely hard disks. Patches, but except for patches and other well-adapted things, most others are confused when encountering a machine with only one disk. (Software heart: Where is the D drive?)

The advantage is that it is neat and easy for users to manage, but the disadvantage is that it is not suitable for mainstream single-partition users.

4. Create a folder in the root directory of the system disk

In fact, the root directory of the system disk can be written without administrator permissions. Creating a folder here not only has good compatibility It is also more convenient for users to manage. This is the position Kotori chose.

After selecting the folder, the next step is to consider that the user may not only use a greening software, but creating a folder with one software will easily make the root directory ugly

Regarding this problem, Qinlili’s solution is to create a large folder, which is divided into software folders. This will also make it easier for users to delete unnecessary caches

Next we will learn about X-Cache What is the difference from the traditional method?

First startup: Release the file in the same way as the traditional method, but release it to the specified directory, and do not delete the file when exiting

Second startup: Detect the For the files left at the time, it is judged whether the file versions match. If they match, they will be skipped. If they do not match, they will be overwritten.

After determining the principle, we can proceed

Qin Lili uses a Take a game that is about 180M after packaging as an example

This is a CAB self-extracting

Unpack and run it first

I found that the game automatically organized the files

It is worth mentioning that for this kind of software/game that will significantly modify the directory structure when it is first started, you should run it once before packaging it, otherwise X-Cache will not be able to maximize its advantages

Run it again to confirm this That is, after the current directory structure will not change, package it. It is recommended to use 7z extreme compression to save space

To get such a compressed package, open the compressed package and click self-extracting (you can use good compression, winrar, etc. to support generating and customizing Compression software for self-extracting files)

As in the normal production process, unpack and get the icon and set it up

In the "Update" tab, select decompress and update the file and overwrite all respectively. File

Set the decompression path to the cache directory you specified. Here Qinlili sets up the KOTORI_GameCache folder on the C drive

At the same time, set the decompression after decompression before decompression and pre-release in the same way as the traditional method. Files

Select Hide All in the mode. Of course, you can also hide the startup dialog box to show the progress. Personally, I prefer to choose Hide All to ensure a high-quality experience on high-end machines

If your software Administrator rights are required, don’t forget to check the box that asks for administrator rights (may be displayed as administrator password/UAC, etc.)

It is recommended to return the resource manager to the upper directory first, otherwise high-end machines may There is a situation where it cannot be written and is occupied (the resource manager takes the first step)

Wait patiently for the processing to be completed

Finally, put an upx shell on the self-extracting file to save space

< p>Next let's test it

Click run and you can see that a large number of writes have begun

We found the released files in the cache folder

< p>The game runs normally

Exit the game and keep the cache

Start it again. You can see that only the CPU surges at startup and no hard disk writes are made

Observation Modification time, confirm that the file has not been modified

Now we can delete the files in the cache at will

This file is released again during startup

The cache directory is found again This file

Now let’s see what happens if we get a new green version

This is the original configuration file

The configuration in the self-extracting Manipulate the file and save it

Run the modified file, but not all overwrite

Open the configuration file in the cache directory, it has obviously become the modified content

< p>Check the modification time to make sure it is new

Now delete the cache directory

Start it again and run normally

The file appears again in the cache directory

By now you should have understood the principle of X-Cache, which is to create a cache that is not deleted in time to speed up loading. For users with slow hard disks, the acceleration is obvious

And X-Cache is not superior at all. , with the help of compression software, novices can easily make it. Only Qin Lili will say that this is more like an idea, an idea to keep the cache longer

Click to like Is it good?

Qinlili Black History Complete Set

Tieba Cloud Toolbox that supports cloud sign-in

The old APP can also have a clean background!

A compact and easy-to-use MD5 verification tool

It allows you to take screenshots with a background!