Tag:Single case

  • Using swoole to create MySQL connection pool

    Time:2020-1-14

    1、 What is MySQL connection pool Scenario: there are 1000 concurrent connections per second, but this MySQL can only handle 400 connections at the same time, and MySQL will go down. Solution: connection pool. This connection pool establishes 200 connections with MySQL. These 1000 concurrent connections share 200 connections in the connection pool in sequence.This […]

  • How is spring cycle dependency resolved?

    Time:2020-1-8

    Answer: circular dependency is circular reference, which means that two or more beans hold each other. For example, if circlea references circleb and circleb references circlea, they are finally reflected as a ring. How does spring solve circular dependency? Suppose the scenario is as follows: a – > b – > A 1. Instantiate a, […]

  • Method sharing of php7 mongodb extension

    Time:2019-12-24

    Preface Recent projects need to upgrade php5.6 to php7.0. Students who have used PHP Mongo extension should know that the mongodb extension of php7.0 is completely incompatible with the Mongo extension of php5.6. How to use PHP mongodb instead. The following describes the use of various methods directly: 1. Mongodb connection: private function connect($confArr) { […]

  • Spring basic learning 01

    Time:2019-12-21

    Spring foundation Spring is an open source design level framework, which solves the loose coupling problem between business logic layer and other layers, so it runs the interface oriented programming idea through the whole system application IOC control reverse Transfer the right to create and maintain the relationship between objects to spring management. Spring container […]

  • 6. Multithreaded singleton mode

    Time:2019-10-31

          The original singleton mode is no longer applicable in multithreaded environment, so what should I do? Answer: (1) single instance mode of thread safety with double locking     (2) static initialization singleton mode     Direct instantiationSingletonObject inGetInstanceMethod_Instanceobject   We know that static members are initialized only once, that is to […]

  • Deep understanding of JavaScript Singleton Pattern

    Time:2019-9-17

    concept Singleton pattern, also known as singleton pattern, is a common software design pattern. When applying this pattern, the class of a singleton object must ensure that only one instance exists. Core: Make sure there is only one instance and provide global access. Implementation ideas A class can return an object with a reference (always […]

  • Simple Chat Room

    Time:2019-8-16

    First: PHP server, running through liunx server <?php class Chat { Const HOST = 0.0.0.0′; //ip address 0.0.0.0 represents acceptance of all IP access Const PART = 81;//port number Private $server = null; // Store websocket_server objects singly Private $connectList = []; // client’s ID collection public function __construct() { // Instantiate swoole_websocket_server and store […]

  • [php design pattern] singleton pattern

    Time:2019-6-5

    Three key points for realizing singletons: 1. Use a static member to maintain a single instance 2. A private constructor allows the class to be instantiated only in the internal method of the class 3. In the static method of instantiating an object, it is first judged whether the static variable has been assigned, and […]

  • Initial Learning Notes for Design Patterns (Single Case Patterns)

    Time:2019-5-20

    About design patterns, long ago through reading some information on the Internet about the design patterns (recommended big-story design patterns), although it seems to understand, but each time when the need to use the relevant design patterns, always can not remember, mainly for each design pattern use scenario has not been thoroughly studied, has remained […]

  • [iOS-OC] OC Foundation-Implementation of Singletons

    Time:2019-4-12

    Multithreading should always be considered in client development. I started with front-end development, and I often didn’t think enough about it. Bear in mind. Common Writing of Singles There are actually two common ways to write singletons 1. dependent locks + (id)sharedInstance { static testClass *sharedInstance = nil; @synchronized(self) { if (!sharedInstance) { sharedInstance = […]