Cache Management

No Comments on Cache Management

Not to be confused with “cash management”.

Part II of our final coding project for CPSC 220 was to build a cache manager that would store info in an array, allow the user to attempt to enter new stuff into that array, check the array to make sure that new stuff didn’t already exist, and if it really was new stuff, go ahead and let the user enter it. This time, the array was NOT to be sorted as it was entered, but instead let the user periodically sort it from a list of menu choices. The info that was to be stored in the array was a website URL, the MIME type of the website, its size in bytes and the date it was last downloaded. Pretty simple elementary stuff, really.

The point of the exercise was to keep us thinking in terms of object-oriented programming, keep us thinking about re-usable, encapsulated code, and to keep us coding. It could have been more complex with added requirements such as sorting by download date, or validation of the URL entry, but I suspect  Dr. Professor was giving us an end-of-semester break by keeping it simple.  *whew*

The framing of the assignment requirements built upon the previous project where we used a makefile to hook up all the class files and header files we wrote to work with our main program file.

I noticed that Dr. Professor preferred to use a more compact style of brackets, which I adopted for this assignment, after years of typing brackets on a






This will make my code more visually compact, and will hopefully be easier to follow when I have to hunt for missing closing brackets. Not that it ever happens to me.  Mm hmm.

Oh, and we had to have at least one function in our main program, so I made two.  ‘Cause I’m like that.  So, here are some code snippets with those two functions, that display the user menu and get the user’s input.  Don’t laugh too hard, it’s still a beginner programming course.

I got the Crayon plug-in working there to hold code snippets.  Pretty slick now, eh? I like that I can turn off word wrapping in that window, so it doesn’t mess up the layout of my code. That means the user has to scroll laterally, but hey, you have to do some of this work too. It can’t all fall on me.




Leave a Reply

Your email address will not be published. Required fields are marked *