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

add max cache size to StreamHub (initial) #1289

Conversation

DaveSkender
Copy link
Owner

Add functionality to specify a maximum size for the in-memory storage of the internal Cache list and prune the earliest items when the max size is met.

  • Interface Changes:

    • Add MaxCacheSize property to IStreamHub interface in src/_common/Observables/IStreamHub.cs.
    • Add PruneCache method to IStreamHub interface.
  • StreamHub Class Changes:

    • Implement MaxCacheSize property in StreamHub class in src/_common/Observables/StreamHub.cs.
    • Implement PruneCache method in StreamHub class to remove earliest items from Cache list.
    • Update Add and AppendCache methods in StreamHub class to check Cache size and prune items if max size is exceeded.
  • Observable Changes:

    • Add NotifyObserversOnPrune method in src/_common/Observables/StreamHub.Observable.cs to notify observers when items are pruned from the Cache list.
  • Observer Changes:

    • Add OnPrune method to IStreamObserver interface in src/_common/Observables/IStreamObserver.cs.
    • Implement OnPrune method in StreamHub class in src/_common/Observables/StreamHub.Observer.cs to handle prune notifications.
  • Tests:

    • Add tests in tests/indicators/_common/Observables/StreamHub.CacheMgmt.Tests.cs to verify the functionality of the MaxCacheSize property and the pruning of the Cache list.

Add functionality to specify a maximum size for the in-memory storage of the internal Cache list and prune the earliest items when the max size is met.

- **Interface Changes**:
  - Add `MaxCacheSize` property to `IStreamHub` interface in `src/_common/Observables/IStreamHub.cs`.
  - Add `PruneCache` method to `IStreamHub` interface.

- **StreamHub Class Changes**:
  - Implement `MaxCacheSize` property in `StreamHub` class in `src/_common/Observables/StreamHub.cs`.
  - Implement `PruneCache` method in `StreamHub` class to remove earliest items from Cache list.
  - Update `Add` and `AppendCache` methods in `StreamHub` class to check Cache size and prune items if max size is exceeded.

- **Observable Changes**:
  - Add `NotifyObserversOnPrune` method in `src/_common/Observables/StreamHub.Observable.cs` to notify observers when items are pruned from the Cache list.

- **Observer Changes**:
  - Add `OnPrune` method to `IStreamObserver` interface in `src/_common/Observables/IStreamObserver.cs`.
  - Implement `OnPrune` method in `StreamHub` class in `src/_common/Observables/StreamHub.Observer.cs` to handle prune notifications.

- **Tests**:
  - Add tests in `tests/indicators/_common/Observables/StreamHub.CacheMgmt.Tests.cs` to verify the functionality of the `MaxCacheSize` property and the pruning of the Cache list.
Copy link

github-actions bot commented Dec 15, 2024

Hey there and thank you for opening this pull request! 👋🏼

It looks like your proposed Pull request title needs to be adjusted.

🚩 Error » No release type found in pull request title "add max cache size to StreamHub (initial)". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

Pull request title naming convention

Our PR title name taxonomy is type: Subject, where type is typically
feat, fix, or chore, and subject is a phrase (proper noun) that starts
with a capitalized letter. The chore type usually has a subject that starts
with an action verb like Add or Update. Examples:

  • feat: Admin portal login
  • fix: Divide by zero in X calculation
  • chore: Update packages
  • docs: Improve setup guidance

See the Conventional Commits specification for more information.

@DaveSkender DaveSkender changed the title Add max cache size to StreamHub add max cache size to StreamHub (initial) Dec 15, 2024
@DaveSkender DaveSkender merged commit e2b0406 into 1095-auto-prune-in-memory-stream-data Dec 15, 2024
2 of 9 checks passed
@DaveSkender DaveSkender deleted the initial-pruning-elements-incomplete- branch December 15, 2024 22:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant