Skip to content

Glasgow | 26-Jul-SDC | Shreef Ibrahim | Sprint 2 |ImplementLRUcachePython - #252

Open
shreefAhmedM wants to merge 2 commits into
CodeYourFuture:mainfrom
shreefAhmedM:implementLRUcachePy
Open

shreefAhmedM wants to merge 2 commits into
CodeYourFuture:mainfrom
shreefAhmedM:implementLRUcachePy

Conversation

@shreefAhmedM

@shreefAhmedM shreefAhmedM commented Oct 14, 2026 •

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1181

Changelist

@shreefAhmedM shreefAhmedM added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 14, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To better adhere to the Single-Responsibility Principle (SRP) from SOLID design principles, it's preferable to implement the "doubly linked list" and the "LRU Cache" as separate classes, with the linked list used inside LruCache to manage ordering.

You could copy your linked_list.py to this folder and use it.

Alternatively, you could use a suitable Python built-in class.

Could you update your code using one of these approaches?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 15, 2026
@shreefAhmedM

Copy link
Copy Markdown
Author

To better adhere to the Single-Responsibility Principle (SRP) from SOLID design principles, it's preferable to implement the "doubly linked list" and the "LRU Cache" as separate classes, with the linked list used inside LruCache to manage ordering.

You could copy your linked_list.py to this folder and use it.

Alternatively, you could use a suitable Python built-in class.

Could you update your code using one of these approaches?

Thanks for the feedback. I've updated the implementation to use Python's built-in OrderedDict to manage cache ordering and LRU eviction, removing the need for a custom doubly linked list. I've kept the existing interface and tests compatible.

@shreefAhmedM shreefAhmedM added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 16, 2026
@cjyuan

cjyuan commented Oct 16, 2026

Copy link
Copy Markdown

Looks good.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants