com.boss.user.service.UserService#clearUserCaches cannot clear the redis cache. because user.getLogin() is "admin", but the key in redis hash is "xFCKcom.boss.user.repository.UserRepository_findOneWithAuthoritiesByLogin_admin"
com.boss.user.service.UserService#clearUserCaches
private void clearUserCaches(User user) {
Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE)).evict(user.getLogin());
}
the key in redis hash "usersByLogin":
\xFCKcom.boss.user.repository.UserRepository_findOneWithAuthoritiesByLogin_admin

6.7.0
entityName.json files generated in the .jhipster directory@TonyLuo : Could you please give some more information on how to reproduce this error. Maybe fill the issue template by including the .yo-rc.json file and any entity configurations you've created. :smile:
@SudharakaP FYI
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator
[email protected] D:\dev\next\test
`-- [email protected]
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.7.1",
"applicationType": "monolith",
"baseName": "test",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "redis",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl", "embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "none",
"clientThemeVariant": "",
"creationTimestamp": 1582169100503,
"testFrameworks": [],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en", "zh-cn"],
"blueprints": []
}
}
entityName.json files generated in the .jhipster directory
JDL entity definitions
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
git version 2.23.0.windows.1
node: v10.16.3
npm: 6.13.7
yeoman: 3.1.1
yarn: 1.19.0
Docker version 19.03.5, build 633a0ea
docker-compose version 1.24.1, build 4667896b
cc @Shaolans as he's the one who coded initially the Redis cache
I will investigate ASAP !
Hello, sorry for the late reply.
I tried to reproduce your issue, however it seems to be working fine.
When I call clearUserCaches, the usersByLogin is cleared.
Have you updated the generator to the 6.7.X ? Because the method clearUserCaches is different from what I have generated.
public void clearUserCaches(User user) {
Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE)).evict(user.getLogin());
if (user.getEmail() != null) {
Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE)).evict(user.getEmail());
}
}
thanks for reply. I did upgrade to 6.7.X.
I just removed following code as our application didn't need it:
if (user.getEmail() != null) {
Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE)).evict(user.getEmail());
}
Since your issue does not appear with the app I generated with your .yo-rc.json, can you give me more details on how to reproduce it with minimal changes ?
Closing this as we can't reproduce
Feel free to provide more steps if you're sure about your issue
Most helpful comment
cc @Shaolans as he's the one who coded initially the Redis cache