Generalization of the Einstein-Straus model to anisotropic settings