One of the most essential building blocks in modem electronics is the flip-flop. A flip-flop operates bi-stably between two states, remaining at a given output level (high or low level) until a specific input control signal changes. For many years, photonics has attempted to build all-optical flip-flops [1-3]; however, the success of these approaches has usually been limited by the dependence of the bi-stable operation on bit-rate and optical power [1, 2]. Furthermore, in most of the reported demonstrations, the storage time is inherently short. Typically, the figure-of-merit of these devices is measured by the time-bandwidth product, which is defined as the storage time of the device times the available bandwidth. State-of-the-art values are in the order of 10-100.This work proposes a method to generate all-optical flip-flops based on dynamic Brillouin gratings (DBGs) in polarisation maintaining fibres (PMF) [4]. Contrarily to existing approaches, this method can allow extremely long storage times and arbitrarily high bandwidth response. The technique relies on generating a very long, weak DBG along a PMF. The experimental setup here used as a proof-of-concept is shown in Fig. 1(a) (see ref. 4 for details). The DBG is generated by launching two continuous-wave pumps (Pump1 and Pump2) through the opposite sides of a 1 m-long Panda PMF. Both pumps are amplified by Erbium-doped fibre amplifiers (EDFAs) up to 25 dBm and aligned to the fast axis of the PMF. An electro-optic modulator is used to shift the optical frequency of one of the pumps, so that the frequencies fulfil the condition: fPump1 = fPump2 - QB, where QB (=10.8 GHz) is the Brillouin frequency along the fast axis of the PMF. The created DBG acts as the all-optical equivalent of an integrator [4]. To read the DBG, 300 ps pulses with controlled phase are generated (see lower branch in Fig. 1(a)) and launched along the slow axis of the PMF at the probe frequency fProbe = (nfast/nslow)fPump1, where nfast and nslow are the fibre refractive indexes along fast and slow axes. The output state of the flip-flop is changed (i.e. set and reset) using pulses with opposite phases. This flip-flop response is then observed at frequency.