Nanophotonic Cavity Based Synapse for Scalable Photonic Neural Networks