CustomSkinLoader

CustomSkinLoader

1M Downloads

Force disabling cache.

Opened this issue ยท 7 comments

commented

Hello.

I'm trying to force downloading the skins every times or found a way to make them instant expire in the cache but I can't find a proper documentation about the different options.
Set cacheExpiry to 0 or 1 doesn't make the skin expire and I don't know what is the unit of this value.
I still don't know what forceLoadAllTextures is. May be it forces downloading a textures from all the source.
enableCacheAutoClean looks like it's starting the cleaning process only when the game is starting and is for cleaning expired textures.
enableLocalProfileCache as no effect. The profil is always cached.
In legacy mode, the textures are cached and in CustomSkinAPI mode both textures and profil are cached, even with enableLocalProfileCache to false.

I'm also curious to know if it could be possible to force refresing the skins without reconnecting.
Some spigot plugins like this one achieves to make the player's game to refresh the skins.

commented

I noticed that your server returned responce code 304 while requesting http://launcher.warshovel.com/skins/XXXXX.json.
HTTP code 304 means USE CACHE.

commented

If you do need disable all network cache including json and texture, you can change forceDisableCache to true in lastest snapshot.

NOTICE
If the switch forceDisableCache turn on, ALL PROFILES AND TEXTURES will be loaded from server when used.

Latest snapshot

Forge: https://csl.littleservice.cn/mods/CustomSkinLoader_Forge-14.13-SNAPSHOT-168.jar
Fabric: https://csl.littleservice.cn/mods/CustomSkinLoader_Fabric-14.13-SNAPSHOT-168.jar

commented

Hello,

About my server, I'm not running a full skin server, just a web server and I build myself with a plugin the textures and the file structure.
Here is an exemple for my account:
http://launcher.warshovel.com/skins/Tai1er.json
http://launcher.warshovel.com/skins/textures/20

The new forceDisableCache option is working PERFECTLY. Thank you for adding this new feature. ๐Ÿ˜ƒ

commented

Thank you for the answers ๐Ÿ˜„
The random(0,5) is may be here because to avoid uncaching too much textures at the same moment.
I have already tried to set cacheExpiry to 0 with no result.
-5 has no result too. The profil is still in the cache for some times. The offset is probably not 0 in this case.
Same for -100 and -3600. It's always load the cached profil.

[2020-05-17 22:37:32] [XXXXX INFO] Loading XXXXX's profile.
[2020-05-17 22:37:32] [XXXXX INFO] 1/1 Try to load profile from 'WarShovel'.
[2020-05-17 22:37:32] [XXXXX DEBUG] Try to request 'http://launcher.warshovel.com/skins/XXXXX.json'.
[2020-05-17 22:37:32] [XXXXX DEBUG] Successfully request (Response Code: 304 , Content Length: -1)
[2020-05-17 22:37:32] [XXXXX DEBUG] Cache file found (Length: 126 , Path: 'C:\Users\YYYYYY\AppData\Roaming\WarShovel\profil\CustomSkinLoader\caches\2b2d5f45a82016b7933829f6eba73a8e44b20e79' , Expire: 0')
[2020-05-17 22:37:32] [XXXXX INFO] Try to load from cache 'C:\Users\YYYYYY\AppData\Roaming\WarShovel\profil\CustomSkinLoader\caches\2b2d5f45a82016b7933829f6eba73a8e44b20e79'.
[2020-05-17 22:37:32] [XXXXX DEBUG] Successfully load from cache
[2020-05-17 22:37:32] [XXXXX DEBUG] Content: {
    "username": "XXXXX",
    "skins": {
        "default": "test",
        "slim": null
    },
    "cape": "XXXXX-cape"
}

[2020-05-17 22:37:32] [XXXXX INFO] XXXXX's profile loaded.
[2020-05-17 22:37:32] [XXXXX INFO] (SkinUrl: http://launcher.warshovel.com/skins/textures/test , Model: default , CapeUrl: http://launcher.warshovel.com/skins/textures/XXXXX-cape  , Expiry: 1589744254)
[2020-05-17 22:37:32] [Client thread DEBUG] Loading type:SKIN
[2020-05-17 22:37:32] [Client thread DEBUG] Loading type:CAPE

The problem is the cacheExpiry value change the Expiry values for the textures, but not for the profil. It' shows an Expiry value of 0 for the profil (probably because enableLocalProfileCache is set to false) but it's still save and load the profil from cache.

commented

forceLoadAllTextures means CSL will keep querying the servers in loadlist utill all textures (skin and cape) are loaded.

According to the MCBBS thread, setting cacheExpiry to 0 is equal to disable cache. The unit is second.

commented

I don't know why random(0,5) exists here, so if you want to disable caches completely, you should set cacheExpiry to -5 or lower.

commented

Hey, I have a violent solution: set the caches directory to read-only.