In this work, we present an all-optical flip-flop (AOFF) structure based on non-linear materials in two-dimensional photon crystal substrate. In this hexagonal square structure, we propose a nonlinear resonance nanocavity to show the trade-off between switching time and triggering power. The linear rods material is made of silicon with a refractive index n0 = 2.6 and the non-linear rods material is made of AlGaAs with a refractive index of n1 = 1.4 and n2 = 1.5×10-17 W/µm2. The proposed Flip-Flop is the RS type (RSFF) and center signal wavelength is λ = 1.550 µm, and is one of the most efficient and practical structures used in optically integrated circuits. This design has a fast switching function of 2 ps and low input power with a power of 100 mW. The minimum power loss in the structure is P loss = 2 mw Another advantage of this structure is the high contrast of the output signals for the ON/OFF modes, which can help to easily detect or connect it to other optical devices. The proposed structure is designed to be very simple and very small dimensions (S = 86.21 µm2), which can be used in an integrated optical circuit. In addition, we provide a very in-depth view of system performance, as analyzed using the two-dimensional time-constraint (2D-FDTD) method