当前位置:网站首页>[designmode] flyweight pattern

[designmode] flyweight pattern

2022-07-07 16:36:00 weixin_ forty-three million two hundred and twenty-four thousan

Basic introduction

  1. The flyweight pattern (Flyweight Pattern) Also called Flyweight Pattern : Using sharing technology to effectively support a large number of fine-grained objects

  2. It is often used in the bottom development of the system , Solve the performance problem of the system . Like a database connection pool , There are all created connection objects , In these connection objects, we need to use them directly , Avoid recreating , If there is nothing we need , Then create a

  3. The sharing mode can solve the problem of memory waste of duplicate objects , When there are a lot of similar objects in the system , When a buffer pool is needed . You don't have to always create new objects , It can be taken from the buffer pool . This can reduce system memory , Improve efficiency at the same time

  4. The classic application scenario of the sharing mode is pool technology ,String Constant pool 、 Database connection pool 、 Buffer pool and so on are all applications of the sharing element mode , Sharing mode is an important way to implement pool technology

1. Show website project needs

Small outsourcing projects , To the customer A Make a product display website , Customer A My friends feel good , Also hope to do such a product display website , But the requirements are different :

  1. Some customers request to release in the form of news

  2. There are clients who want to blog

  3. Some customers want to publish it in the form of WeChat official account

2. Traditional solution website show project

  1. Copy and paste a copy directly , Then according to the different requirements of customers , Make custom changes

  2. Rent a space for each website

  3. Schematic diagram of scheme design

原网站

版权声明
本文为[weixin_ forty-three million two hundred and twenty-four thousan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071416475175.html