Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: add wrapper for the loading cache #9638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 5, 2024

Description

Follow up for #9628
Creates a utility class LazyCache which currently wraps Caffeine library Cache class.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 5, 2024

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

shwstppr added a commit to shapeblue/cloudstack that referenced this pull request Sep 5, 2024
Follow up for apache#9638
Creates a utility class LazyCache which currently wraps Caffeine library Cache class.

Signed-off-by: Abhishek Kumar <[email protected]>
Follow up for apache#9628
Creates a utility class LazyCache which currently wraps Caffeine library Cache class.

Signed-off-by: Abhishek Kumar <[email protected]>
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 15.58%. Comparing base (2245d98) to head (e6f1090).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...a/org/apache/cloudstack/utils/cache/LazyCache.java 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               main    #9638     +/-   ##
===========================================
  Coverage     15.57%   15.58%             
- Complexity    12056    12060      +4     
===========================================
  Files          5506     5507      +1     
  Lines        482919   482932     +13     
  Branches      61184    62859   +1675     
===========================================
+ Hits          75233    75245     +12     
  Misses       399375   399375             
- Partials       8311     8312      +1     
Flag Coverage Δ
uitests 4.17% <ø> (ø)
unittests 16.36% <94.44%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10982

import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;

public class LazyCache<K, V> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit - CacheUtils ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally didn't use *Utils as we are/will be creating objects of this class unlike other static Utils classes. Any other suggestions maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about org.apache.cloudstack.utils.Cache, @shwstppr ?

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@shwstppr shwstppr marked this pull request as ready for review September 6, 2024 11:16
@JoaoJandre JoaoJandre modified the milestones: 4.20.0.0, 4.21.0.0 Sep 10, 2024
@rohityadavcloud rohityadavcloud modified the milestones: 4.21.0.0, 4.20.1.0 Sep 12, 2024
@rohityadavcloud
Copy link
Member

@DaanHoogland @JoaoJandre do we need manual testing or is the smoketests good enough? Looks like just refactoring to me.

@blueorangutan test

@blueorangutan
Copy link

@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-11458)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 51399 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9638-t11458-kvm-ol8.zip
Smoke tests completed. 138 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_secure_vm_migration Error 400.00 test_vm_life_cycle.py

@JoaoJandre
Copy link
Contributor

@shwstppr @rohityadavcloud why is this needed for 4.20? It seems like it could go in 4.20.1

@shwstppr
Copy link
Contributor Author

@JoaoJandre It is just refactoring and good to have. I'm okay if you want to move it to 4.20.1.

@JoaoJandre JoaoJandre modified the milestones: 4.20.0.0, 4.20.1.0 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants