I think it would probably depend on the location you have picked within each of these areas as to which I'd prefer. Here is a map of the area of Encinitas that would be walking distance to Moonlight Beach, + restaurants + a train station if you chose to take the train instead of driving into San Diego etc.:
Here is a similar map for Cardiff(which I think technically is part of Encinitas)
I assume you'd have a car to get to other places as staying in either of these spots without one would not be a great idea!