How often to take antivirals?

If I have ghsv1 how often should I be taking the vitals? I’m thinking I can take it a few days before sex. I don’t want to to necessarily take one a day for the rest of my life but how many days in advance would help it be protected?