i am using the Toxi solution on this site for tagging bookmarks:
http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html
In controllers, i have a LinkController class
class LinkController
ActionResult AddNewLink(FormCollection collection_)
ActionResult Index()
In Models, i have a LinkRepository:
class LinkRepository
void AddLink(string url, string description, string[] tags)
WebLink[] GetLinks(string[] tags)
WebLink[] GetLinks()
I also have a Tag Repository class:
class TagRepository
string[] GetTags()
My question, is when i want to add new links, i need to update the Tag table and i want that to be optimized. To do that i need to cache the tags somewhere do i dont waste time in the db trying to addd tags that already exists. Do i cache these tags by:
A. Having the LIinkRepository have a reference to the Tag Repository and caching on instantiating
B. Having the LinkController cache it (this feels weird as it would then convert tags to a smaller set of tags that didnt' exist)
C. Other options?